1#[cfg(not(feature = "scalar-math"))]
4use crate::BVec4A;
5use crate::{
6 BVec4, I16Vec2, I16Vec3, I64Vec4, I8Vec4, IVec4, U16Vec4, U64Vec4, U8Vec4, USizeVec4, UVec4,
7};
8
9use core::fmt;
10use core::iter::{Product, Sum};
11use core::{f32, ops::*};
12
13#[inline(always)]
15#[must_use]
16pub const fn i16vec4(x: i16, y: i16, z: i16, w: i16) -> I16Vec4 {
17 I16Vec4::new(x, y, z, w)
18}
19
20#[cfg_attr(not(target_arch = "spirv"), derive(Hash))]
22#[derive(Clone, Copy, PartialEq, Eq)]
23#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
24#[cfg_attr(feature = "cuda", repr(align(8)))]
25#[cfg_attr(not(target_arch = "spirv"), repr(C))]
26#[cfg_attr(target_arch = "spirv", repr(simd))]
27pub struct I16Vec4 {
28 pub x: i16,
29 pub y: i16,
30 pub z: i16,
31 pub w: i16,
32}
33
34impl I16Vec4 {
35 pub const ZERO: Self = Self::splat(0);
37
38 pub const ONE: Self = Self::splat(1);
40
41 pub const NEG_ONE: Self = Self::splat(-1);
43
44 pub const MIN: Self = Self::splat(i16::MIN);
46
47 pub const MAX: Self = Self::splat(i16::MAX);
49
50 pub const X: Self = Self::new(1, 0, 0, 0);
52
53 pub const Y: Self = Self::new(0, 1, 0, 0);
55
56 pub const Z: Self = Self::new(0, 0, 1, 0);
58
59 pub const W: Self = Self::new(0, 0, 0, 1);
61
62 pub const NEG_X: Self = Self::new(-1, 0, 0, 0);
64
65 pub const NEG_Y: Self = Self::new(0, -1, 0, 0);
67
68 pub const NEG_Z: Self = Self::new(0, 0, -1, 0);
70
71 pub const NEG_W: Self = Self::new(0, 0, 0, -1);
73
74 pub const AXES: [Self; 4] = [Self::X, Self::Y, Self::Z, Self::W];
76
77 #[inline(always)]
79 #[must_use]
80 pub const fn new(x: i16, y: i16, z: i16, w: i16) -> Self {
81 Self { x, y, z, w }
82 }
83
84 #[inline]
86 #[must_use]
87 pub const fn splat(v: i16) -> Self {
88 Self {
89 x: v,
90
91 y: v,
92
93 z: v,
94
95 w: v,
96 }
97 }
98
99 #[inline]
101 #[must_use]
102 pub fn map<F>(self, f: F) -> Self
103 where
104 F: Fn(i16) -> i16,
105 {
106 Self::new(f(self.x), f(self.y), f(self.z), f(self.w))
107 }
108
109 #[inline]
115 #[must_use]
116 pub fn select(mask: BVec4, if_true: Self, if_false: Self) -> Self {
117 Self {
118 x: if mask.test(0) { if_true.x } else { if_false.x },
119 y: if mask.test(1) { if_true.y } else { if_false.y },
120 z: if mask.test(2) { if_true.z } else { if_false.z },
121 w: if mask.test(3) { if_true.w } else { if_false.w },
122 }
123 }
124
125 #[inline]
127 #[must_use]
128 pub const fn from_array(a: [i16; 4]) -> Self {
129 Self::new(a[0], a[1], a[2], a[3])
130 }
131
132 #[inline]
134 #[must_use]
135 pub const fn to_array(&self) -> [i16; 4] {
136 [self.x, self.y, self.z, self.w]
137 }
138
139 #[inline]
145 #[must_use]
146 pub const fn from_slice(slice: &[i16]) -> Self {
147 assert!(slice.len() >= 4);
148 Self::new(slice[0], slice[1], slice[2], slice[3])
149 }
150
151 #[inline]
157 pub fn write_to_slice(self, slice: &mut [i16]) {
158 slice[..4].copy_from_slice(&self.to_array());
159 }
160
161 #[inline]
165 #[must_use]
166 pub fn truncate(self) -> I16Vec3 {
167 use crate::swizzles::Vec4Swizzles;
168 self.xyz()
169 }
170
171 #[inline]
173 #[must_use]
174 pub fn with_x(mut self, x: i16) -> Self {
175 self.x = x;
176 self
177 }
178
179 #[inline]
181 #[must_use]
182 pub fn with_y(mut self, y: i16) -> Self {
183 self.y = y;
184 self
185 }
186
187 #[inline]
189 #[must_use]
190 pub fn with_z(mut self, z: i16) -> Self {
191 self.z = z;
192 self
193 }
194
195 #[inline]
197 #[must_use]
198 pub fn with_w(mut self, w: i16) -> Self {
199 self.w = w;
200 self
201 }
202
203 #[inline]
205 #[must_use]
206 pub fn dot(self, rhs: Self) -> i16 {
207 (self.x * rhs.x) + (self.y * rhs.y) + (self.z * rhs.z) + (self.w * rhs.w)
208 }
209
210 #[inline]
212 #[must_use]
213 pub fn dot_into_vec(self, rhs: Self) -> Self {
214 Self::splat(self.dot(rhs))
215 }
216
217 #[inline]
221 #[must_use]
222 pub fn min(self, rhs: Self) -> Self {
223 Self {
224 x: if self.x < rhs.x { self.x } else { rhs.x },
225 y: if self.y < rhs.y { self.y } else { rhs.y },
226 z: if self.z < rhs.z { self.z } else { rhs.z },
227 w: if self.w < rhs.w { self.w } else { rhs.w },
228 }
229 }
230
231 #[inline]
235 #[must_use]
236 pub fn max(self, rhs: Self) -> Self {
237 Self {
238 x: if self.x > rhs.x { self.x } else { rhs.x },
239 y: if self.y > rhs.y { self.y } else { rhs.y },
240 z: if self.z > rhs.z { self.z } else { rhs.z },
241 w: if self.w > rhs.w { self.w } else { rhs.w },
242 }
243 }
244
245 #[inline]
253 #[must_use]
254 pub fn clamp(self, min: Self, max: Self) -> Self {
255 glam_assert!(min.cmple(max).all(), "clamp: expected min <= max");
256 self.max(min).min(max)
257 }
258
259 #[inline]
263 #[must_use]
264 pub fn min_element(self) -> i16 {
265 let min = |a, b| if a < b { a } else { b };
266 min(self.x, min(self.y, min(self.z, self.w)))
267 }
268
269 #[inline]
273 #[must_use]
274 pub fn max_element(self) -> i16 {
275 let max = |a, b| if a > b { a } else { b };
276 max(self.x, max(self.y, max(self.z, self.w)))
277 }
278
279 #[doc(alias = "argmin")]
281 #[inline]
282 #[must_use]
283 pub fn min_position(self) -> usize {
284 let mut min = self.x;
285 let mut index = 0;
286 if self.y < min {
287 min = self.y;
288 index = 1;
289 }
290 if self.z < min {
291 min = self.z;
292 index = 2;
293 }
294 if self.w < min {
295 index = 3;
296 }
297 index
298 }
299
300 #[doc(alias = "argmax")]
302 #[inline]
303 #[must_use]
304 pub fn max_position(self) -> usize {
305 let mut max = self.x;
306 let mut index = 0;
307 if self.y > max {
308 max = self.y;
309 index = 1;
310 }
311 if self.z > max {
312 max = self.z;
313 index = 2;
314 }
315 if self.w > max {
316 index = 3;
317 }
318 index
319 }
320
321 #[inline]
325 #[must_use]
326 pub fn element_sum(self) -> i16 {
327 self.x + self.y + self.z + self.w
328 }
329
330 #[inline]
334 #[must_use]
335 pub fn element_product(self) -> i16 {
336 self.x * self.y * self.z * self.w
337 }
338
339 #[inline]
345 #[must_use]
346 pub fn cmpeq(self, rhs: Self) -> BVec4 {
347 BVec4::new(
348 self.x.eq(&rhs.x),
349 self.y.eq(&rhs.y),
350 self.z.eq(&rhs.z),
351 self.w.eq(&rhs.w),
352 )
353 }
354
355 #[inline]
361 #[must_use]
362 pub fn cmpne(self, rhs: Self) -> BVec4 {
363 BVec4::new(
364 self.x.ne(&rhs.x),
365 self.y.ne(&rhs.y),
366 self.z.ne(&rhs.z),
367 self.w.ne(&rhs.w),
368 )
369 }
370
371 #[inline]
377 #[must_use]
378 pub fn cmpge(self, rhs: Self) -> BVec4 {
379 BVec4::new(
380 self.x.ge(&rhs.x),
381 self.y.ge(&rhs.y),
382 self.z.ge(&rhs.z),
383 self.w.ge(&rhs.w),
384 )
385 }
386
387 #[inline]
393 #[must_use]
394 pub fn cmpgt(self, rhs: Self) -> BVec4 {
395 BVec4::new(
396 self.x.gt(&rhs.x),
397 self.y.gt(&rhs.y),
398 self.z.gt(&rhs.z),
399 self.w.gt(&rhs.w),
400 )
401 }
402
403 #[inline]
409 #[must_use]
410 pub fn cmple(self, rhs: Self) -> BVec4 {
411 BVec4::new(
412 self.x.le(&rhs.x),
413 self.y.le(&rhs.y),
414 self.z.le(&rhs.z),
415 self.w.le(&rhs.w),
416 )
417 }
418
419 #[inline]
425 #[must_use]
426 pub fn cmplt(self, rhs: Self) -> BVec4 {
427 BVec4::new(
428 self.x.lt(&rhs.x),
429 self.y.lt(&rhs.y),
430 self.z.lt(&rhs.z),
431 self.w.lt(&rhs.w),
432 )
433 }
434
435 #[inline]
437 #[must_use]
438 pub fn abs(self) -> Self {
439 Self {
440 x: self.x.abs(),
441 y: self.y.abs(),
442 z: self.z.abs(),
443 w: self.w.abs(),
444 }
445 }
446
447 #[inline]
453 #[must_use]
454 pub fn signum(self) -> Self {
455 Self {
456 x: self.x.signum(),
457 y: self.y.signum(),
458 z: self.z.signum(),
459 w: self.w.signum(),
460 }
461 }
462
463 #[inline]
471 #[must_use]
472 pub fn is_negative_bitmask(self) -> u32 {
473 (self.x.is_negative() as u32)
474 | ((self.y.is_negative() as u32) << 1)
475 | ((self.z.is_negative() as u32) << 2)
476 | ((self.w.is_negative() as u32) << 3)
477 }
478
479 #[doc(alias = "magnitude2")]
481 #[inline]
482 #[must_use]
483 pub fn length_squared(self) -> i16 {
484 self.dot(self)
485 }
486
487 #[inline]
489 #[must_use]
490 pub fn distance_squared(self, rhs: Self) -> i16 {
491 (self - rhs).length_squared()
492 }
493
494 #[inline]
499 #[must_use]
500 pub fn div_euclid(self, rhs: Self) -> Self {
501 Self::new(
502 self.x.div_euclid(rhs.x),
503 self.y.div_euclid(rhs.y),
504 self.z.div_euclid(rhs.z),
505 self.w.div_euclid(rhs.w),
506 )
507 }
508
509 #[inline]
516 #[must_use]
517 pub fn rem_euclid(self, rhs: Self) -> Self {
518 Self::new(
519 self.x.rem_euclid(rhs.x),
520 self.y.rem_euclid(rhs.y),
521 self.z.rem_euclid(rhs.z),
522 self.w.rem_euclid(rhs.w),
523 )
524 }
525
526 #[inline]
535 #[must_use]
536 pub fn manhattan_distance(self, rhs: Self) -> u16 {
537 self.x.abs_diff(rhs.x)
538 + self.y.abs_diff(rhs.y)
539 + self.z.abs_diff(rhs.z)
540 + self.w.abs_diff(rhs.w)
541 }
542
543 #[inline]
549 #[must_use]
550 pub fn checked_manhattan_distance(self, rhs: Self) -> Option<u16> {
551 let d = self.x.abs_diff(rhs.x);
552 let d = d.checked_add(self.y.abs_diff(rhs.y))?;
553 let d = d.checked_add(self.z.abs_diff(rhs.z))?;
554 d.checked_add(self.w.abs_diff(rhs.w))
555 }
556
557 #[inline]
561 #[must_use]
562 pub fn chebyshev_distance(self, rhs: Self) -> u16 {
563 [
565 self.x.abs_diff(rhs.x),
566 self.y.abs_diff(rhs.y),
567 self.z.abs_diff(rhs.z),
568 self.w.abs_diff(rhs.w),
569 ]
570 .into_iter()
571 .max()
572 .unwrap()
573 }
574
575 #[inline]
577 #[must_use]
578 pub fn as_vec4(&self) -> crate::Vec4 {
579 crate::Vec4::new(self.x as f32, self.y as f32, self.z as f32, self.w as f32)
580 }
581
582 #[inline]
584 #[must_use]
585 pub fn as_dvec4(&self) -> crate::DVec4 {
586 crate::DVec4::new(self.x as f64, self.y as f64, self.z as f64, self.w as f64)
587 }
588
589 #[inline]
591 #[must_use]
592 pub fn as_i8vec4(&self) -> crate::I8Vec4 {
593 crate::I8Vec4::new(self.x as i8, self.y as i8, self.z as i8, self.w as i8)
594 }
595
596 #[inline]
598 #[must_use]
599 pub fn as_u8vec4(&self) -> crate::U8Vec4 {
600 crate::U8Vec4::new(self.x as u8, self.y as u8, self.z as u8, self.w as u8)
601 }
602
603 #[inline]
605 #[must_use]
606 pub fn as_u16vec4(&self) -> crate::U16Vec4 {
607 crate::U16Vec4::new(self.x as u16, self.y as u16, self.z as u16, self.w as u16)
608 }
609
610 #[inline]
612 #[must_use]
613 pub fn as_ivec4(&self) -> crate::IVec4 {
614 crate::IVec4::new(self.x as i32, self.y as i32, self.z as i32, self.w as i32)
615 }
616
617 #[inline]
619 #[must_use]
620 pub fn as_uvec4(&self) -> crate::UVec4 {
621 crate::UVec4::new(self.x as u32, self.y as u32, self.z as u32, self.w as u32)
622 }
623
624 #[inline]
626 #[must_use]
627 pub fn as_i64vec4(&self) -> crate::I64Vec4 {
628 crate::I64Vec4::new(self.x as i64, self.y as i64, self.z as i64, self.w as i64)
629 }
630
631 #[inline]
633 #[must_use]
634 pub fn as_u64vec4(&self) -> crate::U64Vec4 {
635 crate::U64Vec4::new(self.x as u64, self.y as u64, self.z as u64, self.w as u64)
636 }
637
638 #[inline]
640 #[must_use]
641 pub fn as_usizevec4(&self) -> crate::USizeVec4 {
642 crate::USizeVec4::new(
643 self.x as usize,
644 self.y as usize,
645 self.z as usize,
646 self.w as usize,
647 )
648 }
649
650 #[inline]
654 #[must_use]
655 pub const fn checked_add(self, rhs: Self) -> Option<Self> {
656 let x = match self.x.checked_add(rhs.x) {
657 Some(v) => v,
658 None => return None,
659 };
660 let y = match self.y.checked_add(rhs.y) {
661 Some(v) => v,
662 None => return None,
663 };
664 let z = match self.z.checked_add(rhs.z) {
665 Some(v) => v,
666 None => return None,
667 };
668 let w = match self.w.checked_add(rhs.w) {
669 Some(v) => v,
670 None => return None,
671 };
672
673 Some(Self { x, y, z, w })
674 }
675
676 #[inline]
680 #[must_use]
681 pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
682 let x = match self.x.checked_sub(rhs.x) {
683 Some(v) => v,
684 None => return None,
685 };
686 let y = match self.y.checked_sub(rhs.y) {
687 Some(v) => v,
688 None => return None,
689 };
690 let z = match self.z.checked_sub(rhs.z) {
691 Some(v) => v,
692 None => return None,
693 };
694 let w = match self.w.checked_sub(rhs.w) {
695 Some(v) => v,
696 None => return None,
697 };
698
699 Some(Self { x, y, z, w })
700 }
701
702 #[inline]
706 #[must_use]
707 pub const fn checked_mul(self, rhs: Self) -> Option<Self> {
708 let x = match self.x.checked_mul(rhs.x) {
709 Some(v) => v,
710 None => return None,
711 };
712 let y = match self.y.checked_mul(rhs.y) {
713 Some(v) => v,
714 None => return None,
715 };
716 let z = match self.z.checked_mul(rhs.z) {
717 Some(v) => v,
718 None => return None,
719 };
720 let w = match self.w.checked_mul(rhs.w) {
721 Some(v) => v,
722 None => return None,
723 };
724
725 Some(Self { x, y, z, w })
726 }
727
728 #[inline]
732 #[must_use]
733 pub const fn checked_div(self, rhs: Self) -> Option<Self> {
734 let x = match self.x.checked_div(rhs.x) {
735 Some(v) => v,
736 None => return None,
737 };
738 let y = match self.y.checked_div(rhs.y) {
739 Some(v) => v,
740 None => return None,
741 };
742 let z = match self.z.checked_div(rhs.z) {
743 Some(v) => v,
744 None => return None,
745 };
746 let w = match self.w.checked_div(rhs.w) {
747 Some(v) => v,
748 None => return None,
749 };
750
751 Some(Self { x, y, z, w })
752 }
753
754 #[inline]
758 #[must_use]
759 pub const fn wrapping_add(self, rhs: Self) -> Self {
760 Self {
761 x: self.x.wrapping_add(rhs.x),
762 y: self.y.wrapping_add(rhs.y),
763 z: self.z.wrapping_add(rhs.z),
764 w: self.w.wrapping_add(rhs.w),
765 }
766 }
767
768 #[inline]
772 #[must_use]
773 pub const fn wrapping_sub(self, rhs: Self) -> Self {
774 Self {
775 x: self.x.wrapping_sub(rhs.x),
776 y: self.y.wrapping_sub(rhs.y),
777 z: self.z.wrapping_sub(rhs.z),
778 w: self.w.wrapping_sub(rhs.w),
779 }
780 }
781
782 #[inline]
786 #[must_use]
787 pub const fn wrapping_mul(self, rhs: Self) -> Self {
788 Self {
789 x: self.x.wrapping_mul(rhs.x),
790 y: self.y.wrapping_mul(rhs.y),
791 z: self.z.wrapping_mul(rhs.z),
792 w: self.w.wrapping_mul(rhs.w),
793 }
794 }
795
796 #[inline]
800 #[must_use]
801 pub const fn wrapping_div(self, rhs: Self) -> Self {
802 Self {
803 x: self.x.wrapping_div(rhs.x),
804 y: self.y.wrapping_div(rhs.y),
805 z: self.z.wrapping_div(rhs.z),
806 w: self.w.wrapping_div(rhs.w),
807 }
808 }
809
810 #[inline]
814 #[must_use]
815 pub const fn saturating_add(self, rhs: Self) -> Self {
816 Self {
817 x: self.x.saturating_add(rhs.x),
818 y: self.y.saturating_add(rhs.y),
819 z: self.z.saturating_add(rhs.z),
820 w: self.w.saturating_add(rhs.w),
821 }
822 }
823
824 #[inline]
828 #[must_use]
829 pub const fn saturating_sub(self, rhs: Self) -> Self {
830 Self {
831 x: self.x.saturating_sub(rhs.x),
832 y: self.y.saturating_sub(rhs.y),
833 z: self.z.saturating_sub(rhs.z),
834 w: self.w.saturating_sub(rhs.w),
835 }
836 }
837
838 #[inline]
842 #[must_use]
843 pub const fn saturating_mul(self, rhs: Self) -> Self {
844 Self {
845 x: self.x.saturating_mul(rhs.x),
846 y: self.y.saturating_mul(rhs.y),
847 z: self.z.saturating_mul(rhs.z),
848 w: self.w.saturating_mul(rhs.w),
849 }
850 }
851
852 #[inline]
856 #[must_use]
857 pub const fn saturating_div(self, rhs: Self) -> Self {
858 Self {
859 x: self.x.saturating_div(rhs.x),
860 y: self.y.saturating_div(rhs.y),
861 z: self.z.saturating_div(rhs.z),
862 w: self.w.saturating_div(rhs.w),
863 }
864 }
865
866 #[inline]
870 #[must_use]
871 pub const fn checked_add_unsigned(self, rhs: U16Vec4) -> Option<Self> {
872 let x = match self.x.checked_add_unsigned(rhs.x) {
873 Some(v) => v,
874 None => return None,
875 };
876 let y = match self.y.checked_add_unsigned(rhs.y) {
877 Some(v) => v,
878 None => return None,
879 };
880 let z = match self.z.checked_add_unsigned(rhs.z) {
881 Some(v) => v,
882 None => return None,
883 };
884 let w = match self.w.checked_add_unsigned(rhs.w) {
885 Some(v) => v,
886 None => return None,
887 };
888
889 Some(Self { x, y, z, w })
890 }
891
892 #[inline]
896 #[must_use]
897 pub const fn checked_sub_unsigned(self, rhs: U16Vec4) -> Option<Self> {
898 let x = match self.x.checked_sub_unsigned(rhs.x) {
899 Some(v) => v,
900 None => return None,
901 };
902 let y = match self.y.checked_sub_unsigned(rhs.y) {
903 Some(v) => v,
904 None => return None,
905 };
906 let z = match self.z.checked_sub_unsigned(rhs.z) {
907 Some(v) => v,
908 None => return None,
909 };
910 let w = match self.w.checked_sub_unsigned(rhs.w) {
911 Some(v) => v,
912 None => return None,
913 };
914
915 Some(Self { x, y, z, w })
916 }
917
918 #[inline]
922 #[must_use]
923 pub const fn wrapping_add_unsigned(self, rhs: U16Vec4) -> Self {
924 Self {
925 x: self.x.wrapping_add_unsigned(rhs.x),
926 y: self.y.wrapping_add_unsigned(rhs.y),
927 z: self.z.wrapping_add_unsigned(rhs.z),
928 w: self.w.wrapping_add_unsigned(rhs.w),
929 }
930 }
931
932 #[inline]
936 #[must_use]
937 pub const fn wrapping_sub_unsigned(self, rhs: U16Vec4) -> Self {
938 Self {
939 x: self.x.wrapping_sub_unsigned(rhs.x),
940 y: self.y.wrapping_sub_unsigned(rhs.y),
941 z: self.z.wrapping_sub_unsigned(rhs.z),
942 w: self.w.wrapping_sub_unsigned(rhs.w),
943 }
944 }
945
946 #[inline]
950 #[must_use]
951 pub const fn saturating_add_unsigned(self, rhs: U16Vec4) -> Self {
952 Self {
953 x: self.x.saturating_add_unsigned(rhs.x),
954 y: self.y.saturating_add_unsigned(rhs.y),
955 z: self.z.saturating_add_unsigned(rhs.z),
956 w: self.w.saturating_add_unsigned(rhs.w),
957 }
958 }
959
960 #[inline]
964 #[must_use]
965 pub const fn saturating_sub_unsigned(self, rhs: U16Vec4) -> Self {
966 Self {
967 x: self.x.saturating_sub_unsigned(rhs.x),
968 y: self.y.saturating_sub_unsigned(rhs.y),
969 z: self.z.saturating_sub_unsigned(rhs.z),
970 w: self.w.saturating_sub_unsigned(rhs.w),
971 }
972 }
973}
974
975impl Default for I16Vec4 {
976 #[inline(always)]
977 fn default() -> Self {
978 Self::ZERO
979 }
980}
981
982impl Div for I16Vec4 {
983 type Output = Self;
984 #[inline]
985 fn div(self, rhs: Self) -> Self {
986 Self {
987 x: self.x.div(rhs.x),
988 y: self.y.div(rhs.y),
989 z: self.z.div(rhs.z),
990 w: self.w.div(rhs.w),
991 }
992 }
993}
994
995impl Div<&Self> for I16Vec4 {
996 type Output = Self;
997 #[inline]
998 fn div(self, rhs: &Self) -> Self {
999 self.div(*rhs)
1000 }
1001}
1002
1003impl Div<&I16Vec4> for &I16Vec4 {
1004 type Output = I16Vec4;
1005 #[inline]
1006 fn div(self, rhs: &I16Vec4) -> I16Vec4 {
1007 (*self).div(*rhs)
1008 }
1009}
1010
1011impl Div<I16Vec4> for &I16Vec4 {
1012 type Output = I16Vec4;
1013 #[inline]
1014 fn div(self, rhs: I16Vec4) -> I16Vec4 {
1015 (*self).div(rhs)
1016 }
1017}
1018
1019impl DivAssign for I16Vec4 {
1020 #[inline]
1021 fn div_assign(&mut self, rhs: Self) {
1022 self.x.div_assign(rhs.x);
1023 self.y.div_assign(rhs.y);
1024 self.z.div_assign(rhs.z);
1025 self.w.div_assign(rhs.w);
1026 }
1027}
1028
1029impl DivAssign<&Self> for I16Vec4 {
1030 #[inline]
1031 fn div_assign(&mut self, rhs: &Self) {
1032 self.div_assign(*rhs);
1033 }
1034}
1035
1036impl Div<i16> for I16Vec4 {
1037 type Output = Self;
1038 #[inline]
1039 fn div(self, rhs: i16) -> Self {
1040 Self {
1041 x: self.x.div(rhs),
1042 y: self.y.div(rhs),
1043 z: self.z.div(rhs),
1044 w: self.w.div(rhs),
1045 }
1046 }
1047}
1048
1049impl Div<&i16> for I16Vec4 {
1050 type Output = Self;
1051 #[inline]
1052 fn div(self, rhs: &i16) -> Self {
1053 self.div(*rhs)
1054 }
1055}
1056
1057impl Div<&i16> for &I16Vec4 {
1058 type Output = I16Vec4;
1059 #[inline]
1060 fn div(self, rhs: &i16) -> I16Vec4 {
1061 (*self).div(*rhs)
1062 }
1063}
1064
1065impl Div<i16> for &I16Vec4 {
1066 type Output = I16Vec4;
1067 #[inline]
1068 fn div(self, rhs: i16) -> I16Vec4 {
1069 (*self).div(rhs)
1070 }
1071}
1072
1073impl DivAssign<i16> for I16Vec4 {
1074 #[inline]
1075 fn div_assign(&mut self, rhs: i16) {
1076 self.x.div_assign(rhs);
1077 self.y.div_assign(rhs);
1078 self.z.div_assign(rhs);
1079 self.w.div_assign(rhs);
1080 }
1081}
1082
1083impl DivAssign<&i16> for I16Vec4 {
1084 #[inline]
1085 fn div_assign(&mut self, rhs: &i16) {
1086 self.div_assign(*rhs);
1087 }
1088}
1089
1090impl Div<I16Vec4> for i16 {
1091 type Output = I16Vec4;
1092 #[inline]
1093 fn div(self, rhs: I16Vec4) -> I16Vec4 {
1094 I16Vec4 {
1095 x: self.div(rhs.x),
1096 y: self.div(rhs.y),
1097 z: self.div(rhs.z),
1098 w: self.div(rhs.w),
1099 }
1100 }
1101}
1102
1103impl Div<&I16Vec4> for i16 {
1104 type Output = I16Vec4;
1105 #[inline]
1106 fn div(self, rhs: &I16Vec4) -> I16Vec4 {
1107 self.div(*rhs)
1108 }
1109}
1110
1111impl Div<&I16Vec4> for &i16 {
1112 type Output = I16Vec4;
1113 #[inline]
1114 fn div(self, rhs: &I16Vec4) -> I16Vec4 {
1115 (*self).div(*rhs)
1116 }
1117}
1118
1119impl Div<I16Vec4> for &i16 {
1120 type Output = I16Vec4;
1121 #[inline]
1122 fn div(self, rhs: I16Vec4) -> I16Vec4 {
1123 (*self).div(rhs)
1124 }
1125}
1126
1127impl Mul for I16Vec4 {
1128 type Output = Self;
1129 #[inline]
1130 fn mul(self, rhs: Self) -> Self {
1131 Self {
1132 x: self.x.mul(rhs.x),
1133 y: self.y.mul(rhs.y),
1134 z: self.z.mul(rhs.z),
1135 w: self.w.mul(rhs.w),
1136 }
1137 }
1138}
1139
1140impl Mul<&Self> for I16Vec4 {
1141 type Output = Self;
1142 #[inline]
1143 fn mul(self, rhs: &Self) -> Self {
1144 self.mul(*rhs)
1145 }
1146}
1147
1148impl Mul<&I16Vec4> for &I16Vec4 {
1149 type Output = I16Vec4;
1150 #[inline]
1151 fn mul(self, rhs: &I16Vec4) -> I16Vec4 {
1152 (*self).mul(*rhs)
1153 }
1154}
1155
1156impl Mul<I16Vec4> for &I16Vec4 {
1157 type Output = I16Vec4;
1158 #[inline]
1159 fn mul(self, rhs: I16Vec4) -> I16Vec4 {
1160 (*self).mul(rhs)
1161 }
1162}
1163
1164impl MulAssign for I16Vec4 {
1165 #[inline]
1166 fn mul_assign(&mut self, rhs: Self) {
1167 self.x.mul_assign(rhs.x);
1168 self.y.mul_assign(rhs.y);
1169 self.z.mul_assign(rhs.z);
1170 self.w.mul_assign(rhs.w);
1171 }
1172}
1173
1174impl MulAssign<&Self> for I16Vec4 {
1175 #[inline]
1176 fn mul_assign(&mut self, rhs: &Self) {
1177 self.mul_assign(*rhs);
1178 }
1179}
1180
1181impl Mul<i16> for I16Vec4 {
1182 type Output = Self;
1183 #[inline]
1184 fn mul(self, rhs: i16) -> Self {
1185 Self {
1186 x: self.x.mul(rhs),
1187 y: self.y.mul(rhs),
1188 z: self.z.mul(rhs),
1189 w: self.w.mul(rhs),
1190 }
1191 }
1192}
1193
1194impl Mul<&i16> for I16Vec4 {
1195 type Output = Self;
1196 #[inline]
1197 fn mul(self, rhs: &i16) -> Self {
1198 self.mul(*rhs)
1199 }
1200}
1201
1202impl Mul<&i16> for &I16Vec4 {
1203 type Output = I16Vec4;
1204 #[inline]
1205 fn mul(self, rhs: &i16) -> I16Vec4 {
1206 (*self).mul(*rhs)
1207 }
1208}
1209
1210impl Mul<i16> for &I16Vec4 {
1211 type Output = I16Vec4;
1212 #[inline]
1213 fn mul(self, rhs: i16) -> I16Vec4 {
1214 (*self).mul(rhs)
1215 }
1216}
1217
1218impl MulAssign<i16> for I16Vec4 {
1219 #[inline]
1220 fn mul_assign(&mut self, rhs: i16) {
1221 self.x.mul_assign(rhs);
1222 self.y.mul_assign(rhs);
1223 self.z.mul_assign(rhs);
1224 self.w.mul_assign(rhs);
1225 }
1226}
1227
1228impl MulAssign<&i16> for I16Vec4 {
1229 #[inline]
1230 fn mul_assign(&mut self, rhs: &i16) {
1231 self.mul_assign(*rhs);
1232 }
1233}
1234
1235impl Mul<I16Vec4> for i16 {
1236 type Output = I16Vec4;
1237 #[inline]
1238 fn mul(self, rhs: I16Vec4) -> I16Vec4 {
1239 I16Vec4 {
1240 x: self.mul(rhs.x),
1241 y: self.mul(rhs.y),
1242 z: self.mul(rhs.z),
1243 w: self.mul(rhs.w),
1244 }
1245 }
1246}
1247
1248impl Mul<&I16Vec4> for i16 {
1249 type Output = I16Vec4;
1250 #[inline]
1251 fn mul(self, rhs: &I16Vec4) -> I16Vec4 {
1252 self.mul(*rhs)
1253 }
1254}
1255
1256impl Mul<&I16Vec4> for &i16 {
1257 type Output = I16Vec4;
1258 #[inline]
1259 fn mul(self, rhs: &I16Vec4) -> I16Vec4 {
1260 (*self).mul(*rhs)
1261 }
1262}
1263
1264impl Mul<I16Vec4> for &i16 {
1265 type Output = I16Vec4;
1266 #[inline]
1267 fn mul(self, rhs: I16Vec4) -> I16Vec4 {
1268 (*self).mul(rhs)
1269 }
1270}
1271
1272impl Add for I16Vec4 {
1273 type Output = Self;
1274 #[inline]
1275 fn add(self, rhs: Self) -> Self {
1276 Self {
1277 x: self.x.add(rhs.x),
1278 y: self.y.add(rhs.y),
1279 z: self.z.add(rhs.z),
1280 w: self.w.add(rhs.w),
1281 }
1282 }
1283}
1284
1285impl Add<&Self> for I16Vec4 {
1286 type Output = Self;
1287 #[inline]
1288 fn add(self, rhs: &Self) -> Self {
1289 self.add(*rhs)
1290 }
1291}
1292
1293impl Add<&I16Vec4> for &I16Vec4 {
1294 type Output = I16Vec4;
1295 #[inline]
1296 fn add(self, rhs: &I16Vec4) -> I16Vec4 {
1297 (*self).add(*rhs)
1298 }
1299}
1300
1301impl Add<I16Vec4> for &I16Vec4 {
1302 type Output = I16Vec4;
1303 #[inline]
1304 fn add(self, rhs: I16Vec4) -> I16Vec4 {
1305 (*self).add(rhs)
1306 }
1307}
1308
1309impl AddAssign for I16Vec4 {
1310 #[inline]
1311 fn add_assign(&mut self, rhs: Self) {
1312 self.x.add_assign(rhs.x);
1313 self.y.add_assign(rhs.y);
1314 self.z.add_assign(rhs.z);
1315 self.w.add_assign(rhs.w);
1316 }
1317}
1318
1319impl AddAssign<&Self> for I16Vec4 {
1320 #[inline]
1321 fn add_assign(&mut self, rhs: &Self) {
1322 self.add_assign(*rhs);
1323 }
1324}
1325
1326impl Add<i16> for I16Vec4 {
1327 type Output = Self;
1328 #[inline]
1329 fn add(self, rhs: i16) -> Self {
1330 Self {
1331 x: self.x.add(rhs),
1332 y: self.y.add(rhs),
1333 z: self.z.add(rhs),
1334 w: self.w.add(rhs),
1335 }
1336 }
1337}
1338
1339impl Add<&i16> for I16Vec4 {
1340 type Output = Self;
1341 #[inline]
1342 fn add(self, rhs: &i16) -> Self {
1343 self.add(*rhs)
1344 }
1345}
1346
1347impl Add<&i16> for &I16Vec4 {
1348 type Output = I16Vec4;
1349 #[inline]
1350 fn add(self, rhs: &i16) -> I16Vec4 {
1351 (*self).add(*rhs)
1352 }
1353}
1354
1355impl Add<i16> for &I16Vec4 {
1356 type Output = I16Vec4;
1357 #[inline]
1358 fn add(self, rhs: i16) -> I16Vec4 {
1359 (*self).add(rhs)
1360 }
1361}
1362
1363impl AddAssign<i16> for I16Vec4 {
1364 #[inline]
1365 fn add_assign(&mut self, rhs: i16) {
1366 self.x.add_assign(rhs);
1367 self.y.add_assign(rhs);
1368 self.z.add_assign(rhs);
1369 self.w.add_assign(rhs);
1370 }
1371}
1372
1373impl AddAssign<&i16> for I16Vec4 {
1374 #[inline]
1375 fn add_assign(&mut self, rhs: &i16) {
1376 self.add_assign(*rhs);
1377 }
1378}
1379
1380impl Add<I16Vec4> for i16 {
1381 type Output = I16Vec4;
1382 #[inline]
1383 fn add(self, rhs: I16Vec4) -> I16Vec4 {
1384 I16Vec4 {
1385 x: self.add(rhs.x),
1386 y: self.add(rhs.y),
1387 z: self.add(rhs.z),
1388 w: self.add(rhs.w),
1389 }
1390 }
1391}
1392
1393impl Add<&I16Vec4> for i16 {
1394 type Output = I16Vec4;
1395 #[inline]
1396 fn add(self, rhs: &I16Vec4) -> I16Vec4 {
1397 self.add(*rhs)
1398 }
1399}
1400
1401impl Add<&I16Vec4> for &i16 {
1402 type Output = I16Vec4;
1403 #[inline]
1404 fn add(self, rhs: &I16Vec4) -> I16Vec4 {
1405 (*self).add(*rhs)
1406 }
1407}
1408
1409impl Add<I16Vec4> for &i16 {
1410 type Output = I16Vec4;
1411 #[inline]
1412 fn add(self, rhs: I16Vec4) -> I16Vec4 {
1413 (*self).add(rhs)
1414 }
1415}
1416
1417impl Sub for I16Vec4 {
1418 type Output = Self;
1419 #[inline]
1420 fn sub(self, rhs: Self) -> Self {
1421 Self {
1422 x: self.x.sub(rhs.x),
1423 y: self.y.sub(rhs.y),
1424 z: self.z.sub(rhs.z),
1425 w: self.w.sub(rhs.w),
1426 }
1427 }
1428}
1429
1430impl Sub<&Self> for I16Vec4 {
1431 type Output = Self;
1432 #[inline]
1433 fn sub(self, rhs: &Self) -> Self {
1434 self.sub(*rhs)
1435 }
1436}
1437
1438impl Sub<&I16Vec4> for &I16Vec4 {
1439 type Output = I16Vec4;
1440 #[inline]
1441 fn sub(self, rhs: &I16Vec4) -> I16Vec4 {
1442 (*self).sub(*rhs)
1443 }
1444}
1445
1446impl Sub<I16Vec4> for &I16Vec4 {
1447 type Output = I16Vec4;
1448 #[inline]
1449 fn sub(self, rhs: I16Vec4) -> I16Vec4 {
1450 (*self).sub(rhs)
1451 }
1452}
1453
1454impl SubAssign for I16Vec4 {
1455 #[inline]
1456 fn sub_assign(&mut self, rhs: Self) {
1457 self.x.sub_assign(rhs.x);
1458 self.y.sub_assign(rhs.y);
1459 self.z.sub_assign(rhs.z);
1460 self.w.sub_assign(rhs.w);
1461 }
1462}
1463
1464impl SubAssign<&Self> for I16Vec4 {
1465 #[inline]
1466 fn sub_assign(&mut self, rhs: &Self) {
1467 self.sub_assign(*rhs);
1468 }
1469}
1470
1471impl Sub<i16> for I16Vec4 {
1472 type Output = Self;
1473 #[inline]
1474 fn sub(self, rhs: i16) -> Self {
1475 Self {
1476 x: self.x.sub(rhs),
1477 y: self.y.sub(rhs),
1478 z: self.z.sub(rhs),
1479 w: self.w.sub(rhs),
1480 }
1481 }
1482}
1483
1484impl Sub<&i16> for I16Vec4 {
1485 type Output = Self;
1486 #[inline]
1487 fn sub(self, rhs: &i16) -> Self {
1488 self.sub(*rhs)
1489 }
1490}
1491
1492impl Sub<&i16> for &I16Vec4 {
1493 type Output = I16Vec4;
1494 #[inline]
1495 fn sub(self, rhs: &i16) -> I16Vec4 {
1496 (*self).sub(*rhs)
1497 }
1498}
1499
1500impl Sub<i16> for &I16Vec4 {
1501 type Output = I16Vec4;
1502 #[inline]
1503 fn sub(self, rhs: i16) -> I16Vec4 {
1504 (*self).sub(rhs)
1505 }
1506}
1507
1508impl SubAssign<i16> for I16Vec4 {
1509 #[inline]
1510 fn sub_assign(&mut self, rhs: i16) {
1511 self.x.sub_assign(rhs);
1512 self.y.sub_assign(rhs);
1513 self.z.sub_assign(rhs);
1514 self.w.sub_assign(rhs);
1515 }
1516}
1517
1518impl SubAssign<&i16> for I16Vec4 {
1519 #[inline]
1520 fn sub_assign(&mut self, rhs: &i16) {
1521 self.sub_assign(*rhs);
1522 }
1523}
1524
1525impl Sub<I16Vec4> for i16 {
1526 type Output = I16Vec4;
1527 #[inline]
1528 fn sub(self, rhs: I16Vec4) -> I16Vec4 {
1529 I16Vec4 {
1530 x: self.sub(rhs.x),
1531 y: self.sub(rhs.y),
1532 z: self.sub(rhs.z),
1533 w: self.sub(rhs.w),
1534 }
1535 }
1536}
1537
1538impl Sub<&I16Vec4> for i16 {
1539 type Output = I16Vec4;
1540 #[inline]
1541 fn sub(self, rhs: &I16Vec4) -> I16Vec4 {
1542 self.sub(*rhs)
1543 }
1544}
1545
1546impl Sub<&I16Vec4> for &i16 {
1547 type Output = I16Vec4;
1548 #[inline]
1549 fn sub(self, rhs: &I16Vec4) -> I16Vec4 {
1550 (*self).sub(*rhs)
1551 }
1552}
1553
1554impl Sub<I16Vec4> for &i16 {
1555 type Output = I16Vec4;
1556 #[inline]
1557 fn sub(self, rhs: I16Vec4) -> I16Vec4 {
1558 (*self).sub(rhs)
1559 }
1560}
1561
1562impl Rem for I16Vec4 {
1563 type Output = Self;
1564 #[inline]
1565 fn rem(self, rhs: Self) -> Self {
1566 Self {
1567 x: self.x.rem(rhs.x),
1568 y: self.y.rem(rhs.y),
1569 z: self.z.rem(rhs.z),
1570 w: self.w.rem(rhs.w),
1571 }
1572 }
1573}
1574
1575impl Rem<&Self> for I16Vec4 {
1576 type Output = Self;
1577 #[inline]
1578 fn rem(self, rhs: &Self) -> Self {
1579 self.rem(*rhs)
1580 }
1581}
1582
1583impl Rem<&I16Vec4> for &I16Vec4 {
1584 type Output = I16Vec4;
1585 #[inline]
1586 fn rem(self, rhs: &I16Vec4) -> I16Vec4 {
1587 (*self).rem(*rhs)
1588 }
1589}
1590
1591impl Rem<I16Vec4> for &I16Vec4 {
1592 type Output = I16Vec4;
1593 #[inline]
1594 fn rem(self, rhs: I16Vec4) -> I16Vec4 {
1595 (*self).rem(rhs)
1596 }
1597}
1598
1599impl RemAssign for I16Vec4 {
1600 #[inline]
1601 fn rem_assign(&mut self, rhs: Self) {
1602 self.x.rem_assign(rhs.x);
1603 self.y.rem_assign(rhs.y);
1604 self.z.rem_assign(rhs.z);
1605 self.w.rem_assign(rhs.w);
1606 }
1607}
1608
1609impl RemAssign<&Self> for I16Vec4 {
1610 #[inline]
1611 fn rem_assign(&mut self, rhs: &Self) {
1612 self.rem_assign(*rhs);
1613 }
1614}
1615
1616impl Rem<i16> for I16Vec4 {
1617 type Output = Self;
1618 #[inline]
1619 fn rem(self, rhs: i16) -> Self {
1620 Self {
1621 x: self.x.rem(rhs),
1622 y: self.y.rem(rhs),
1623 z: self.z.rem(rhs),
1624 w: self.w.rem(rhs),
1625 }
1626 }
1627}
1628
1629impl Rem<&i16> for I16Vec4 {
1630 type Output = Self;
1631 #[inline]
1632 fn rem(self, rhs: &i16) -> Self {
1633 self.rem(*rhs)
1634 }
1635}
1636
1637impl Rem<&i16> for &I16Vec4 {
1638 type Output = I16Vec4;
1639 #[inline]
1640 fn rem(self, rhs: &i16) -> I16Vec4 {
1641 (*self).rem(*rhs)
1642 }
1643}
1644
1645impl Rem<i16> for &I16Vec4 {
1646 type Output = I16Vec4;
1647 #[inline]
1648 fn rem(self, rhs: i16) -> I16Vec4 {
1649 (*self).rem(rhs)
1650 }
1651}
1652
1653impl RemAssign<i16> for I16Vec4 {
1654 #[inline]
1655 fn rem_assign(&mut self, rhs: i16) {
1656 self.x.rem_assign(rhs);
1657 self.y.rem_assign(rhs);
1658 self.z.rem_assign(rhs);
1659 self.w.rem_assign(rhs);
1660 }
1661}
1662
1663impl RemAssign<&i16> for I16Vec4 {
1664 #[inline]
1665 fn rem_assign(&mut self, rhs: &i16) {
1666 self.rem_assign(*rhs);
1667 }
1668}
1669
1670impl Rem<I16Vec4> for i16 {
1671 type Output = I16Vec4;
1672 #[inline]
1673 fn rem(self, rhs: I16Vec4) -> I16Vec4 {
1674 I16Vec4 {
1675 x: self.rem(rhs.x),
1676 y: self.rem(rhs.y),
1677 z: self.rem(rhs.z),
1678 w: self.rem(rhs.w),
1679 }
1680 }
1681}
1682
1683impl Rem<&I16Vec4> for i16 {
1684 type Output = I16Vec4;
1685 #[inline]
1686 fn rem(self, rhs: &I16Vec4) -> I16Vec4 {
1687 self.rem(*rhs)
1688 }
1689}
1690
1691impl Rem<&I16Vec4> for &i16 {
1692 type Output = I16Vec4;
1693 #[inline]
1694 fn rem(self, rhs: &I16Vec4) -> I16Vec4 {
1695 (*self).rem(*rhs)
1696 }
1697}
1698
1699impl Rem<I16Vec4> for &i16 {
1700 type Output = I16Vec4;
1701 #[inline]
1702 fn rem(self, rhs: I16Vec4) -> I16Vec4 {
1703 (*self).rem(rhs)
1704 }
1705}
1706
1707#[cfg(not(target_arch = "spirv"))]
1708impl AsRef<[i16; 4]> for I16Vec4 {
1709 #[inline]
1710 fn as_ref(&self) -> &[i16; 4] {
1711 unsafe { &*(self as *const Self as *const [i16; 4]) }
1712 }
1713}
1714
1715#[cfg(not(target_arch = "spirv"))]
1716impl AsMut<[i16; 4]> for I16Vec4 {
1717 #[inline]
1718 fn as_mut(&mut self) -> &mut [i16; 4] {
1719 unsafe { &mut *(self as *mut Self as *mut [i16; 4]) }
1720 }
1721}
1722
1723impl Sum for I16Vec4 {
1724 #[inline]
1725 fn sum<I>(iter: I) -> Self
1726 where
1727 I: Iterator<Item = Self>,
1728 {
1729 iter.fold(Self::ZERO, Self::add)
1730 }
1731}
1732
1733impl<'a> Sum<&'a Self> for I16Vec4 {
1734 #[inline]
1735 fn sum<I>(iter: I) -> Self
1736 where
1737 I: Iterator<Item = &'a Self>,
1738 {
1739 iter.fold(Self::ZERO, |a, &b| Self::add(a, b))
1740 }
1741}
1742
1743impl Product for I16Vec4 {
1744 #[inline]
1745 fn product<I>(iter: I) -> Self
1746 where
1747 I: Iterator<Item = Self>,
1748 {
1749 iter.fold(Self::ONE, Self::mul)
1750 }
1751}
1752
1753impl<'a> Product<&'a Self> for I16Vec4 {
1754 #[inline]
1755 fn product<I>(iter: I) -> Self
1756 where
1757 I: Iterator<Item = &'a Self>,
1758 {
1759 iter.fold(Self::ONE, |a, &b| Self::mul(a, b))
1760 }
1761}
1762
1763impl Neg for I16Vec4 {
1764 type Output = Self;
1765 #[inline]
1766 fn neg(self) -> Self {
1767 Self {
1768 x: self.x.neg(),
1769 y: self.y.neg(),
1770 z: self.z.neg(),
1771 w: self.w.neg(),
1772 }
1773 }
1774}
1775
1776impl Neg for &I16Vec4 {
1777 type Output = I16Vec4;
1778 #[inline]
1779 fn neg(self) -> I16Vec4 {
1780 (*self).neg()
1781 }
1782}
1783
1784impl Not for I16Vec4 {
1785 type Output = Self;
1786 #[inline]
1787 fn not(self) -> Self {
1788 Self {
1789 x: self.x.not(),
1790 y: self.y.not(),
1791 z: self.z.not(),
1792 w: self.w.not(),
1793 }
1794 }
1795}
1796
1797impl Not for &I16Vec4 {
1798 type Output = I16Vec4;
1799 #[inline]
1800 fn not(self) -> I16Vec4 {
1801 (*self).not()
1802 }
1803}
1804
1805impl BitAnd for I16Vec4 {
1806 type Output = Self;
1807 #[inline]
1808 fn bitand(self, rhs: Self) -> Self::Output {
1809 Self {
1810 x: self.x.bitand(rhs.x),
1811 y: self.y.bitand(rhs.y),
1812 z: self.z.bitand(rhs.z),
1813 w: self.w.bitand(rhs.w),
1814 }
1815 }
1816}
1817
1818impl BitAnd<&Self> for I16Vec4 {
1819 type Output = Self;
1820 #[inline]
1821 fn bitand(self, rhs: &Self) -> Self {
1822 self.bitand(*rhs)
1823 }
1824}
1825
1826impl BitAnd<&I16Vec4> for &I16Vec4 {
1827 type Output = I16Vec4;
1828 #[inline]
1829 fn bitand(self, rhs: &I16Vec4) -> I16Vec4 {
1830 (*self).bitand(*rhs)
1831 }
1832}
1833
1834impl BitAnd<I16Vec4> for &I16Vec4 {
1835 type Output = I16Vec4;
1836 #[inline]
1837 fn bitand(self, rhs: I16Vec4) -> I16Vec4 {
1838 (*self).bitand(rhs)
1839 }
1840}
1841
1842impl BitAndAssign for I16Vec4 {
1843 #[inline]
1844 fn bitand_assign(&mut self, rhs: Self) {
1845 *self = self.bitand(rhs);
1846 }
1847}
1848
1849impl BitAndAssign<&Self> for I16Vec4 {
1850 #[inline]
1851 fn bitand_assign(&mut self, rhs: &Self) {
1852 self.bitand_assign(*rhs);
1853 }
1854}
1855
1856impl BitOr for I16Vec4 {
1857 type Output = Self;
1858 #[inline]
1859 fn bitor(self, rhs: Self) -> Self::Output {
1860 Self {
1861 x: self.x.bitor(rhs.x),
1862 y: self.y.bitor(rhs.y),
1863 z: self.z.bitor(rhs.z),
1864 w: self.w.bitor(rhs.w),
1865 }
1866 }
1867}
1868
1869impl BitOr<&Self> for I16Vec4 {
1870 type Output = Self;
1871 #[inline]
1872 fn bitor(self, rhs: &Self) -> Self {
1873 self.bitor(*rhs)
1874 }
1875}
1876
1877impl BitOr<&I16Vec4> for &I16Vec4 {
1878 type Output = I16Vec4;
1879 #[inline]
1880 fn bitor(self, rhs: &I16Vec4) -> I16Vec4 {
1881 (*self).bitor(*rhs)
1882 }
1883}
1884
1885impl BitOr<I16Vec4> for &I16Vec4 {
1886 type Output = I16Vec4;
1887 #[inline]
1888 fn bitor(self, rhs: I16Vec4) -> I16Vec4 {
1889 (*self).bitor(rhs)
1890 }
1891}
1892
1893impl BitOrAssign for I16Vec4 {
1894 #[inline]
1895 fn bitor_assign(&mut self, rhs: Self) {
1896 *self = self.bitor(rhs);
1897 }
1898}
1899
1900impl BitOrAssign<&Self> for I16Vec4 {
1901 #[inline]
1902 fn bitor_assign(&mut self, rhs: &Self) {
1903 self.bitor_assign(*rhs);
1904 }
1905}
1906
1907impl BitXor for I16Vec4 {
1908 type Output = Self;
1909 #[inline]
1910 fn bitxor(self, rhs: Self) -> Self::Output {
1911 Self {
1912 x: self.x.bitxor(rhs.x),
1913 y: self.y.bitxor(rhs.y),
1914 z: self.z.bitxor(rhs.z),
1915 w: self.w.bitxor(rhs.w),
1916 }
1917 }
1918}
1919
1920impl BitXor<&Self> for I16Vec4 {
1921 type Output = Self;
1922 #[inline]
1923 fn bitxor(self, rhs: &Self) -> Self {
1924 self.bitxor(*rhs)
1925 }
1926}
1927
1928impl BitXor<&I16Vec4> for &I16Vec4 {
1929 type Output = I16Vec4;
1930 #[inline]
1931 fn bitxor(self, rhs: &I16Vec4) -> I16Vec4 {
1932 (*self).bitxor(*rhs)
1933 }
1934}
1935
1936impl BitXor<I16Vec4> for &I16Vec4 {
1937 type Output = I16Vec4;
1938 #[inline]
1939 fn bitxor(self, rhs: I16Vec4) -> I16Vec4 {
1940 (*self).bitxor(rhs)
1941 }
1942}
1943
1944impl BitXorAssign for I16Vec4 {
1945 #[inline]
1946 fn bitxor_assign(&mut self, rhs: Self) {
1947 *self = self.bitxor(rhs);
1948 }
1949}
1950
1951impl BitXorAssign<&Self> for I16Vec4 {
1952 #[inline]
1953 fn bitxor_assign(&mut self, rhs: &Self) {
1954 self.bitxor_assign(*rhs);
1955 }
1956}
1957
1958impl BitAnd<i16> for I16Vec4 {
1959 type Output = Self;
1960 #[inline]
1961 fn bitand(self, rhs: i16) -> Self::Output {
1962 Self {
1963 x: self.x.bitand(rhs),
1964 y: self.y.bitand(rhs),
1965 z: self.z.bitand(rhs),
1966 w: self.w.bitand(rhs),
1967 }
1968 }
1969}
1970
1971impl BitAnd<&i16> for I16Vec4 {
1972 type Output = Self;
1973 #[inline]
1974 fn bitand(self, rhs: &i16) -> Self {
1975 self.bitand(*rhs)
1976 }
1977}
1978
1979impl BitAnd<&i16> for &I16Vec4 {
1980 type Output = I16Vec4;
1981 #[inline]
1982 fn bitand(self, rhs: &i16) -> I16Vec4 {
1983 (*self).bitand(*rhs)
1984 }
1985}
1986
1987impl BitAnd<i16> for &I16Vec4 {
1988 type Output = I16Vec4;
1989 #[inline]
1990 fn bitand(self, rhs: i16) -> I16Vec4 {
1991 (*self).bitand(rhs)
1992 }
1993}
1994
1995impl BitAndAssign<i16> for I16Vec4 {
1996 #[inline]
1997 fn bitand_assign(&mut self, rhs: i16) {
1998 *self = self.bitand(rhs);
1999 }
2000}
2001
2002impl BitAndAssign<&i16> for I16Vec4 {
2003 #[inline]
2004 fn bitand_assign(&mut self, rhs: &i16) {
2005 self.bitand_assign(*rhs);
2006 }
2007}
2008
2009impl BitOr<i16> for I16Vec4 {
2010 type Output = Self;
2011 #[inline]
2012 fn bitor(self, rhs: i16) -> Self::Output {
2013 Self {
2014 x: self.x.bitor(rhs),
2015 y: self.y.bitor(rhs),
2016 z: self.z.bitor(rhs),
2017 w: self.w.bitor(rhs),
2018 }
2019 }
2020}
2021
2022impl BitOr<&i16> for I16Vec4 {
2023 type Output = Self;
2024 #[inline]
2025 fn bitor(self, rhs: &i16) -> Self {
2026 self.bitor(*rhs)
2027 }
2028}
2029
2030impl BitOr<&i16> for &I16Vec4 {
2031 type Output = I16Vec4;
2032 #[inline]
2033 fn bitor(self, rhs: &i16) -> I16Vec4 {
2034 (*self).bitor(*rhs)
2035 }
2036}
2037
2038impl BitOr<i16> for &I16Vec4 {
2039 type Output = I16Vec4;
2040 #[inline]
2041 fn bitor(self, rhs: i16) -> I16Vec4 {
2042 (*self).bitor(rhs)
2043 }
2044}
2045
2046impl BitOrAssign<i16> for I16Vec4 {
2047 #[inline]
2048 fn bitor_assign(&mut self, rhs: i16) {
2049 *self = self.bitor(rhs);
2050 }
2051}
2052
2053impl BitOrAssign<&i16> for I16Vec4 {
2054 #[inline]
2055 fn bitor_assign(&mut self, rhs: &i16) {
2056 self.bitor_assign(*rhs);
2057 }
2058}
2059
2060impl BitXor<i16> for I16Vec4 {
2061 type Output = Self;
2062 #[inline]
2063 fn bitxor(self, rhs: i16) -> Self::Output {
2064 Self {
2065 x: self.x.bitxor(rhs),
2066 y: self.y.bitxor(rhs),
2067 z: self.z.bitxor(rhs),
2068 w: self.w.bitxor(rhs),
2069 }
2070 }
2071}
2072
2073impl BitXor<&i16> for I16Vec4 {
2074 type Output = Self;
2075 #[inline]
2076 fn bitxor(self, rhs: &i16) -> Self {
2077 self.bitxor(*rhs)
2078 }
2079}
2080
2081impl BitXor<&i16> for &I16Vec4 {
2082 type Output = I16Vec4;
2083 #[inline]
2084 fn bitxor(self, rhs: &i16) -> I16Vec4 {
2085 (*self).bitxor(*rhs)
2086 }
2087}
2088
2089impl BitXor<i16> for &I16Vec4 {
2090 type Output = I16Vec4;
2091 #[inline]
2092 fn bitxor(self, rhs: i16) -> I16Vec4 {
2093 (*self).bitxor(rhs)
2094 }
2095}
2096
2097impl BitXorAssign<i16> for I16Vec4 {
2098 #[inline]
2099 fn bitxor_assign(&mut self, rhs: i16) {
2100 *self = self.bitxor(rhs);
2101 }
2102}
2103
2104impl BitXorAssign<&i16> for I16Vec4 {
2105 #[inline]
2106 fn bitxor_assign(&mut self, rhs: &i16) {
2107 self.bitxor_assign(*rhs);
2108 }
2109}
2110
2111impl Shl<i8> for I16Vec4 {
2112 type Output = Self;
2113 #[inline]
2114 fn shl(self, rhs: i8) -> Self::Output {
2115 Self {
2116 x: self.x.shl(rhs),
2117 y: self.y.shl(rhs),
2118 z: self.z.shl(rhs),
2119 w: self.w.shl(rhs),
2120 }
2121 }
2122}
2123
2124impl Shl<&i8> for I16Vec4 {
2125 type Output = Self;
2126 #[inline]
2127 fn shl(self, rhs: &i8) -> Self {
2128 self.shl(*rhs)
2129 }
2130}
2131
2132impl Shl<&i8> for &I16Vec4 {
2133 type Output = I16Vec4;
2134 #[inline]
2135 fn shl(self, rhs: &i8) -> I16Vec4 {
2136 (*self).shl(*rhs)
2137 }
2138}
2139
2140impl Shl<i8> for &I16Vec4 {
2141 type Output = I16Vec4;
2142 #[inline]
2143 fn shl(self, rhs: i8) -> I16Vec4 {
2144 (*self).shl(rhs)
2145 }
2146}
2147
2148impl ShlAssign<i8> for I16Vec4 {
2149 #[inline]
2150 fn shl_assign(&mut self, rhs: i8) {
2151 *self = self.shl(rhs);
2152 }
2153}
2154
2155impl ShlAssign<&i8> for I16Vec4 {
2156 #[inline]
2157 fn shl_assign(&mut self, rhs: &i8) {
2158 self.shl_assign(*rhs);
2159 }
2160}
2161
2162impl Shr<i8> for I16Vec4 {
2163 type Output = Self;
2164 #[inline]
2165 fn shr(self, rhs: i8) -> Self::Output {
2166 Self {
2167 x: self.x.shr(rhs),
2168 y: self.y.shr(rhs),
2169 z: self.z.shr(rhs),
2170 w: self.w.shr(rhs),
2171 }
2172 }
2173}
2174
2175impl Shr<&i8> for I16Vec4 {
2176 type Output = Self;
2177 #[inline]
2178 fn shr(self, rhs: &i8) -> Self {
2179 self.shr(*rhs)
2180 }
2181}
2182
2183impl Shr<&i8> for &I16Vec4 {
2184 type Output = I16Vec4;
2185 #[inline]
2186 fn shr(self, rhs: &i8) -> I16Vec4 {
2187 (*self).shr(*rhs)
2188 }
2189}
2190
2191impl Shr<i8> for &I16Vec4 {
2192 type Output = I16Vec4;
2193 #[inline]
2194 fn shr(self, rhs: i8) -> I16Vec4 {
2195 (*self).shr(rhs)
2196 }
2197}
2198
2199impl ShrAssign<i8> for I16Vec4 {
2200 #[inline]
2201 fn shr_assign(&mut self, rhs: i8) {
2202 *self = self.shr(rhs);
2203 }
2204}
2205
2206impl ShrAssign<&i8> for I16Vec4 {
2207 #[inline]
2208 fn shr_assign(&mut self, rhs: &i8) {
2209 self.shr_assign(*rhs);
2210 }
2211}
2212
2213impl Shl<i16> for I16Vec4 {
2214 type Output = Self;
2215 #[inline]
2216 fn shl(self, rhs: i16) -> Self::Output {
2217 Self {
2218 x: self.x.shl(rhs),
2219 y: self.y.shl(rhs),
2220 z: self.z.shl(rhs),
2221 w: self.w.shl(rhs),
2222 }
2223 }
2224}
2225
2226impl Shl<&i16> for I16Vec4 {
2227 type Output = Self;
2228 #[inline]
2229 fn shl(self, rhs: &i16) -> Self {
2230 self.shl(*rhs)
2231 }
2232}
2233
2234impl Shl<&i16> for &I16Vec4 {
2235 type Output = I16Vec4;
2236 #[inline]
2237 fn shl(self, rhs: &i16) -> I16Vec4 {
2238 (*self).shl(*rhs)
2239 }
2240}
2241
2242impl Shl<i16> for &I16Vec4 {
2243 type Output = I16Vec4;
2244 #[inline]
2245 fn shl(self, rhs: i16) -> I16Vec4 {
2246 (*self).shl(rhs)
2247 }
2248}
2249
2250impl ShlAssign<i16> for I16Vec4 {
2251 #[inline]
2252 fn shl_assign(&mut self, rhs: i16) {
2253 *self = self.shl(rhs);
2254 }
2255}
2256
2257impl ShlAssign<&i16> for I16Vec4 {
2258 #[inline]
2259 fn shl_assign(&mut self, rhs: &i16) {
2260 self.shl_assign(*rhs);
2261 }
2262}
2263
2264impl Shr<i16> for I16Vec4 {
2265 type Output = Self;
2266 #[inline]
2267 fn shr(self, rhs: i16) -> Self::Output {
2268 Self {
2269 x: self.x.shr(rhs),
2270 y: self.y.shr(rhs),
2271 z: self.z.shr(rhs),
2272 w: self.w.shr(rhs),
2273 }
2274 }
2275}
2276
2277impl Shr<&i16> for I16Vec4 {
2278 type Output = Self;
2279 #[inline]
2280 fn shr(self, rhs: &i16) -> Self {
2281 self.shr(*rhs)
2282 }
2283}
2284
2285impl Shr<&i16> for &I16Vec4 {
2286 type Output = I16Vec4;
2287 #[inline]
2288 fn shr(self, rhs: &i16) -> I16Vec4 {
2289 (*self).shr(*rhs)
2290 }
2291}
2292
2293impl Shr<i16> for &I16Vec4 {
2294 type Output = I16Vec4;
2295 #[inline]
2296 fn shr(self, rhs: i16) -> I16Vec4 {
2297 (*self).shr(rhs)
2298 }
2299}
2300
2301impl ShrAssign<i16> for I16Vec4 {
2302 #[inline]
2303 fn shr_assign(&mut self, rhs: i16) {
2304 *self = self.shr(rhs);
2305 }
2306}
2307
2308impl ShrAssign<&i16> for I16Vec4 {
2309 #[inline]
2310 fn shr_assign(&mut self, rhs: &i16) {
2311 self.shr_assign(*rhs);
2312 }
2313}
2314
2315impl Shl<i32> for I16Vec4 {
2316 type Output = Self;
2317 #[inline]
2318 fn shl(self, rhs: i32) -> Self::Output {
2319 Self {
2320 x: self.x.shl(rhs),
2321 y: self.y.shl(rhs),
2322 z: self.z.shl(rhs),
2323 w: self.w.shl(rhs),
2324 }
2325 }
2326}
2327
2328impl Shl<&i32> for I16Vec4 {
2329 type Output = Self;
2330 #[inline]
2331 fn shl(self, rhs: &i32) -> Self {
2332 self.shl(*rhs)
2333 }
2334}
2335
2336impl Shl<&i32> for &I16Vec4 {
2337 type Output = I16Vec4;
2338 #[inline]
2339 fn shl(self, rhs: &i32) -> I16Vec4 {
2340 (*self).shl(*rhs)
2341 }
2342}
2343
2344impl Shl<i32> for &I16Vec4 {
2345 type Output = I16Vec4;
2346 #[inline]
2347 fn shl(self, rhs: i32) -> I16Vec4 {
2348 (*self).shl(rhs)
2349 }
2350}
2351
2352impl ShlAssign<i32> for I16Vec4 {
2353 #[inline]
2354 fn shl_assign(&mut self, rhs: i32) {
2355 *self = self.shl(rhs);
2356 }
2357}
2358
2359impl ShlAssign<&i32> for I16Vec4 {
2360 #[inline]
2361 fn shl_assign(&mut self, rhs: &i32) {
2362 self.shl_assign(*rhs);
2363 }
2364}
2365
2366impl Shr<i32> for I16Vec4 {
2367 type Output = Self;
2368 #[inline]
2369 fn shr(self, rhs: i32) -> Self::Output {
2370 Self {
2371 x: self.x.shr(rhs),
2372 y: self.y.shr(rhs),
2373 z: self.z.shr(rhs),
2374 w: self.w.shr(rhs),
2375 }
2376 }
2377}
2378
2379impl Shr<&i32> for I16Vec4 {
2380 type Output = Self;
2381 #[inline]
2382 fn shr(self, rhs: &i32) -> Self {
2383 self.shr(*rhs)
2384 }
2385}
2386
2387impl Shr<&i32> for &I16Vec4 {
2388 type Output = I16Vec4;
2389 #[inline]
2390 fn shr(self, rhs: &i32) -> I16Vec4 {
2391 (*self).shr(*rhs)
2392 }
2393}
2394
2395impl Shr<i32> for &I16Vec4 {
2396 type Output = I16Vec4;
2397 #[inline]
2398 fn shr(self, rhs: i32) -> I16Vec4 {
2399 (*self).shr(rhs)
2400 }
2401}
2402
2403impl ShrAssign<i32> for I16Vec4 {
2404 #[inline]
2405 fn shr_assign(&mut self, rhs: i32) {
2406 *self = self.shr(rhs);
2407 }
2408}
2409
2410impl ShrAssign<&i32> for I16Vec4 {
2411 #[inline]
2412 fn shr_assign(&mut self, rhs: &i32) {
2413 self.shr_assign(*rhs);
2414 }
2415}
2416
2417impl Shl<i64> for I16Vec4 {
2418 type Output = Self;
2419 #[inline]
2420 fn shl(self, rhs: i64) -> Self::Output {
2421 Self {
2422 x: self.x.shl(rhs),
2423 y: self.y.shl(rhs),
2424 z: self.z.shl(rhs),
2425 w: self.w.shl(rhs),
2426 }
2427 }
2428}
2429
2430impl Shl<&i64> for I16Vec4 {
2431 type Output = Self;
2432 #[inline]
2433 fn shl(self, rhs: &i64) -> Self {
2434 self.shl(*rhs)
2435 }
2436}
2437
2438impl Shl<&i64> for &I16Vec4 {
2439 type Output = I16Vec4;
2440 #[inline]
2441 fn shl(self, rhs: &i64) -> I16Vec4 {
2442 (*self).shl(*rhs)
2443 }
2444}
2445
2446impl Shl<i64> for &I16Vec4 {
2447 type Output = I16Vec4;
2448 #[inline]
2449 fn shl(self, rhs: i64) -> I16Vec4 {
2450 (*self).shl(rhs)
2451 }
2452}
2453
2454impl ShlAssign<i64> for I16Vec4 {
2455 #[inline]
2456 fn shl_assign(&mut self, rhs: i64) {
2457 *self = self.shl(rhs);
2458 }
2459}
2460
2461impl ShlAssign<&i64> for I16Vec4 {
2462 #[inline]
2463 fn shl_assign(&mut self, rhs: &i64) {
2464 self.shl_assign(*rhs);
2465 }
2466}
2467
2468impl Shr<i64> for I16Vec4 {
2469 type Output = Self;
2470 #[inline]
2471 fn shr(self, rhs: i64) -> Self::Output {
2472 Self {
2473 x: self.x.shr(rhs),
2474 y: self.y.shr(rhs),
2475 z: self.z.shr(rhs),
2476 w: self.w.shr(rhs),
2477 }
2478 }
2479}
2480
2481impl Shr<&i64> for I16Vec4 {
2482 type Output = Self;
2483 #[inline]
2484 fn shr(self, rhs: &i64) -> Self {
2485 self.shr(*rhs)
2486 }
2487}
2488
2489impl Shr<&i64> for &I16Vec4 {
2490 type Output = I16Vec4;
2491 #[inline]
2492 fn shr(self, rhs: &i64) -> I16Vec4 {
2493 (*self).shr(*rhs)
2494 }
2495}
2496
2497impl Shr<i64> for &I16Vec4 {
2498 type Output = I16Vec4;
2499 #[inline]
2500 fn shr(self, rhs: i64) -> I16Vec4 {
2501 (*self).shr(rhs)
2502 }
2503}
2504
2505impl ShrAssign<i64> for I16Vec4 {
2506 #[inline]
2507 fn shr_assign(&mut self, rhs: i64) {
2508 *self = self.shr(rhs);
2509 }
2510}
2511
2512impl ShrAssign<&i64> for I16Vec4 {
2513 #[inline]
2514 fn shr_assign(&mut self, rhs: &i64) {
2515 self.shr_assign(*rhs);
2516 }
2517}
2518
2519impl Shl<u8> for I16Vec4 {
2520 type Output = Self;
2521 #[inline]
2522 fn shl(self, rhs: u8) -> Self::Output {
2523 Self {
2524 x: self.x.shl(rhs),
2525 y: self.y.shl(rhs),
2526 z: self.z.shl(rhs),
2527 w: self.w.shl(rhs),
2528 }
2529 }
2530}
2531
2532impl Shl<&u8> for I16Vec4 {
2533 type Output = Self;
2534 #[inline]
2535 fn shl(self, rhs: &u8) -> Self {
2536 self.shl(*rhs)
2537 }
2538}
2539
2540impl Shl<&u8> for &I16Vec4 {
2541 type Output = I16Vec4;
2542 #[inline]
2543 fn shl(self, rhs: &u8) -> I16Vec4 {
2544 (*self).shl(*rhs)
2545 }
2546}
2547
2548impl Shl<u8> for &I16Vec4 {
2549 type Output = I16Vec4;
2550 #[inline]
2551 fn shl(self, rhs: u8) -> I16Vec4 {
2552 (*self).shl(rhs)
2553 }
2554}
2555
2556impl ShlAssign<u8> for I16Vec4 {
2557 #[inline]
2558 fn shl_assign(&mut self, rhs: u8) {
2559 *self = self.shl(rhs);
2560 }
2561}
2562
2563impl ShlAssign<&u8> for I16Vec4 {
2564 #[inline]
2565 fn shl_assign(&mut self, rhs: &u8) {
2566 self.shl_assign(*rhs);
2567 }
2568}
2569
2570impl Shr<u8> for I16Vec4 {
2571 type Output = Self;
2572 #[inline]
2573 fn shr(self, rhs: u8) -> Self::Output {
2574 Self {
2575 x: self.x.shr(rhs),
2576 y: self.y.shr(rhs),
2577 z: self.z.shr(rhs),
2578 w: self.w.shr(rhs),
2579 }
2580 }
2581}
2582
2583impl Shr<&u8> for I16Vec4 {
2584 type Output = Self;
2585 #[inline]
2586 fn shr(self, rhs: &u8) -> Self {
2587 self.shr(*rhs)
2588 }
2589}
2590
2591impl Shr<&u8> for &I16Vec4 {
2592 type Output = I16Vec4;
2593 #[inline]
2594 fn shr(self, rhs: &u8) -> I16Vec4 {
2595 (*self).shr(*rhs)
2596 }
2597}
2598
2599impl Shr<u8> for &I16Vec4 {
2600 type Output = I16Vec4;
2601 #[inline]
2602 fn shr(self, rhs: u8) -> I16Vec4 {
2603 (*self).shr(rhs)
2604 }
2605}
2606
2607impl ShrAssign<u8> for I16Vec4 {
2608 #[inline]
2609 fn shr_assign(&mut self, rhs: u8) {
2610 *self = self.shr(rhs);
2611 }
2612}
2613
2614impl ShrAssign<&u8> for I16Vec4 {
2615 #[inline]
2616 fn shr_assign(&mut self, rhs: &u8) {
2617 self.shr_assign(*rhs);
2618 }
2619}
2620
2621impl Shl<u16> for I16Vec4 {
2622 type Output = Self;
2623 #[inline]
2624 fn shl(self, rhs: u16) -> Self::Output {
2625 Self {
2626 x: self.x.shl(rhs),
2627 y: self.y.shl(rhs),
2628 z: self.z.shl(rhs),
2629 w: self.w.shl(rhs),
2630 }
2631 }
2632}
2633
2634impl Shl<&u16> for I16Vec4 {
2635 type Output = Self;
2636 #[inline]
2637 fn shl(self, rhs: &u16) -> Self {
2638 self.shl(*rhs)
2639 }
2640}
2641
2642impl Shl<&u16> for &I16Vec4 {
2643 type Output = I16Vec4;
2644 #[inline]
2645 fn shl(self, rhs: &u16) -> I16Vec4 {
2646 (*self).shl(*rhs)
2647 }
2648}
2649
2650impl Shl<u16> for &I16Vec4 {
2651 type Output = I16Vec4;
2652 #[inline]
2653 fn shl(self, rhs: u16) -> I16Vec4 {
2654 (*self).shl(rhs)
2655 }
2656}
2657
2658impl ShlAssign<u16> for I16Vec4 {
2659 #[inline]
2660 fn shl_assign(&mut self, rhs: u16) {
2661 *self = self.shl(rhs);
2662 }
2663}
2664
2665impl ShlAssign<&u16> for I16Vec4 {
2666 #[inline]
2667 fn shl_assign(&mut self, rhs: &u16) {
2668 self.shl_assign(*rhs);
2669 }
2670}
2671
2672impl Shr<u16> for I16Vec4 {
2673 type Output = Self;
2674 #[inline]
2675 fn shr(self, rhs: u16) -> Self::Output {
2676 Self {
2677 x: self.x.shr(rhs),
2678 y: self.y.shr(rhs),
2679 z: self.z.shr(rhs),
2680 w: self.w.shr(rhs),
2681 }
2682 }
2683}
2684
2685impl Shr<&u16> for I16Vec4 {
2686 type Output = Self;
2687 #[inline]
2688 fn shr(self, rhs: &u16) -> Self {
2689 self.shr(*rhs)
2690 }
2691}
2692
2693impl Shr<&u16> for &I16Vec4 {
2694 type Output = I16Vec4;
2695 #[inline]
2696 fn shr(self, rhs: &u16) -> I16Vec4 {
2697 (*self).shr(*rhs)
2698 }
2699}
2700
2701impl Shr<u16> for &I16Vec4 {
2702 type Output = I16Vec4;
2703 #[inline]
2704 fn shr(self, rhs: u16) -> I16Vec4 {
2705 (*self).shr(rhs)
2706 }
2707}
2708
2709impl ShrAssign<u16> for I16Vec4 {
2710 #[inline]
2711 fn shr_assign(&mut self, rhs: u16) {
2712 *self = self.shr(rhs);
2713 }
2714}
2715
2716impl ShrAssign<&u16> for I16Vec4 {
2717 #[inline]
2718 fn shr_assign(&mut self, rhs: &u16) {
2719 self.shr_assign(*rhs);
2720 }
2721}
2722
2723impl Shl<u32> for I16Vec4 {
2724 type Output = Self;
2725 #[inline]
2726 fn shl(self, rhs: u32) -> Self::Output {
2727 Self {
2728 x: self.x.shl(rhs),
2729 y: self.y.shl(rhs),
2730 z: self.z.shl(rhs),
2731 w: self.w.shl(rhs),
2732 }
2733 }
2734}
2735
2736impl Shl<&u32> for I16Vec4 {
2737 type Output = Self;
2738 #[inline]
2739 fn shl(self, rhs: &u32) -> Self {
2740 self.shl(*rhs)
2741 }
2742}
2743
2744impl Shl<&u32> for &I16Vec4 {
2745 type Output = I16Vec4;
2746 #[inline]
2747 fn shl(self, rhs: &u32) -> I16Vec4 {
2748 (*self).shl(*rhs)
2749 }
2750}
2751
2752impl Shl<u32> for &I16Vec4 {
2753 type Output = I16Vec4;
2754 #[inline]
2755 fn shl(self, rhs: u32) -> I16Vec4 {
2756 (*self).shl(rhs)
2757 }
2758}
2759
2760impl ShlAssign<u32> for I16Vec4 {
2761 #[inline]
2762 fn shl_assign(&mut self, rhs: u32) {
2763 *self = self.shl(rhs);
2764 }
2765}
2766
2767impl ShlAssign<&u32> for I16Vec4 {
2768 #[inline]
2769 fn shl_assign(&mut self, rhs: &u32) {
2770 self.shl_assign(*rhs);
2771 }
2772}
2773
2774impl Shr<u32> for I16Vec4 {
2775 type Output = Self;
2776 #[inline]
2777 fn shr(self, rhs: u32) -> Self::Output {
2778 Self {
2779 x: self.x.shr(rhs),
2780 y: self.y.shr(rhs),
2781 z: self.z.shr(rhs),
2782 w: self.w.shr(rhs),
2783 }
2784 }
2785}
2786
2787impl Shr<&u32> for I16Vec4 {
2788 type Output = Self;
2789 #[inline]
2790 fn shr(self, rhs: &u32) -> Self {
2791 self.shr(*rhs)
2792 }
2793}
2794
2795impl Shr<&u32> for &I16Vec4 {
2796 type Output = I16Vec4;
2797 #[inline]
2798 fn shr(self, rhs: &u32) -> I16Vec4 {
2799 (*self).shr(*rhs)
2800 }
2801}
2802
2803impl Shr<u32> for &I16Vec4 {
2804 type Output = I16Vec4;
2805 #[inline]
2806 fn shr(self, rhs: u32) -> I16Vec4 {
2807 (*self).shr(rhs)
2808 }
2809}
2810
2811impl ShrAssign<u32> for I16Vec4 {
2812 #[inline]
2813 fn shr_assign(&mut self, rhs: u32) {
2814 *self = self.shr(rhs);
2815 }
2816}
2817
2818impl ShrAssign<&u32> for I16Vec4 {
2819 #[inline]
2820 fn shr_assign(&mut self, rhs: &u32) {
2821 self.shr_assign(*rhs);
2822 }
2823}
2824
2825impl Shl<u64> for I16Vec4 {
2826 type Output = Self;
2827 #[inline]
2828 fn shl(self, rhs: u64) -> Self::Output {
2829 Self {
2830 x: self.x.shl(rhs),
2831 y: self.y.shl(rhs),
2832 z: self.z.shl(rhs),
2833 w: self.w.shl(rhs),
2834 }
2835 }
2836}
2837
2838impl Shl<&u64> for I16Vec4 {
2839 type Output = Self;
2840 #[inline]
2841 fn shl(self, rhs: &u64) -> Self {
2842 self.shl(*rhs)
2843 }
2844}
2845
2846impl Shl<&u64> for &I16Vec4 {
2847 type Output = I16Vec4;
2848 #[inline]
2849 fn shl(self, rhs: &u64) -> I16Vec4 {
2850 (*self).shl(*rhs)
2851 }
2852}
2853
2854impl Shl<u64> for &I16Vec4 {
2855 type Output = I16Vec4;
2856 #[inline]
2857 fn shl(self, rhs: u64) -> I16Vec4 {
2858 (*self).shl(rhs)
2859 }
2860}
2861
2862impl ShlAssign<u64> for I16Vec4 {
2863 #[inline]
2864 fn shl_assign(&mut self, rhs: u64) {
2865 *self = self.shl(rhs);
2866 }
2867}
2868
2869impl ShlAssign<&u64> for I16Vec4 {
2870 #[inline]
2871 fn shl_assign(&mut self, rhs: &u64) {
2872 self.shl_assign(*rhs);
2873 }
2874}
2875
2876impl Shr<u64> for I16Vec4 {
2877 type Output = Self;
2878 #[inline]
2879 fn shr(self, rhs: u64) -> Self::Output {
2880 Self {
2881 x: self.x.shr(rhs),
2882 y: self.y.shr(rhs),
2883 z: self.z.shr(rhs),
2884 w: self.w.shr(rhs),
2885 }
2886 }
2887}
2888
2889impl Shr<&u64> for I16Vec4 {
2890 type Output = Self;
2891 #[inline]
2892 fn shr(self, rhs: &u64) -> Self {
2893 self.shr(*rhs)
2894 }
2895}
2896
2897impl Shr<&u64> for &I16Vec4 {
2898 type Output = I16Vec4;
2899 #[inline]
2900 fn shr(self, rhs: &u64) -> I16Vec4 {
2901 (*self).shr(*rhs)
2902 }
2903}
2904
2905impl Shr<u64> for &I16Vec4 {
2906 type Output = I16Vec4;
2907 #[inline]
2908 fn shr(self, rhs: u64) -> I16Vec4 {
2909 (*self).shr(rhs)
2910 }
2911}
2912
2913impl ShrAssign<u64> for I16Vec4 {
2914 #[inline]
2915 fn shr_assign(&mut self, rhs: u64) {
2916 *self = self.shr(rhs);
2917 }
2918}
2919
2920impl ShrAssign<&u64> for I16Vec4 {
2921 #[inline]
2922 fn shr_assign(&mut self, rhs: &u64) {
2923 self.shr_assign(*rhs);
2924 }
2925}
2926
2927impl Shl<IVec4> for I16Vec4 {
2928 type Output = Self;
2929 #[inline]
2930 fn shl(self, rhs: IVec4) -> Self {
2931 Self {
2932 x: self.x.shl(rhs.x),
2933 y: self.y.shl(rhs.y),
2934 z: self.z.shl(rhs.z),
2935 w: self.w.shl(rhs.w),
2936 }
2937 }
2938}
2939
2940impl Shl<&IVec4> for I16Vec4 {
2941 type Output = Self;
2942 #[inline]
2943 fn shl(self, rhs: &IVec4) -> Self {
2944 self.shl(*rhs)
2945 }
2946}
2947
2948impl Shl<&IVec4> for &I16Vec4 {
2949 type Output = I16Vec4;
2950 #[inline]
2951 fn shl(self, rhs: &IVec4) -> I16Vec4 {
2952 (*self).shl(*rhs)
2953 }
2954}
2955
2956impl Shl<IVec4> for &I16Vec4 {
2957 type Output = I16Vec4;
2958 #[inline]
2959 fn shl(self, rhs: IVec4) -> I16Vec4 {
2960 (*self).shl(rhs)
2961 }
2962}
2963
2964impl Shr<IVec4> for I16Vec4 {
2965 type Output = Self;
2966 #[inline]
2967 fn shr(self, rhs: IVec4) -> Self {
2968 Self {
2969 x: self.x.shr(rhs.x),
2970 y: self.y.shr(rhs.y),
2971 z: self.z.shr(rhs.z),
2972 w: self.w.shr(rhs.w),
2973 }
2974 }
2975}
2976
2977impl Shr<&IVec4> for I16Vec4 {
2978 type Output = Self;
2979 #[inline]
2980 fn shr(self, rhs: &IVec4) -> Self {
2981 self.shr(*rhs)
2982 }
2983}
2984
2985impl Shr<&IVec4> for &I16Vec4 {
2986 type Output = I16Vec4;
2987 #[inline]
2988 fn shr(self, rhs: &IVec4) -> I16Vec4 {
2989 (*self).shr(*rhs)
2990 }
2991}
2992
2993impl Shr<IVec4> for &I16Vec4 {
2994 type Output = I16Vec4;
2995 #[inline]
2996 fn shr(self, rhs: IVec4) -> I16Vec4 {
2997 (*self).shr(rhs)
2998 }
2999}
3000
3001impl Shl<UVec4> for I16Vec4 {
3002 type Output = Self;
3003 #[inline]
3004 fn shl(self, rhs: UVec4) -> Self {
3005 Self {
3006 x: self.x.shl(rhs.x),
3007 y: self.y.shl(rhs.y),
3008 z: self.z.shl(rhs.z),
3009 w: self.w.shl(rhs.w),
3010 }
3011 }
3012}
3013
3014impl Shl<&UVec4> for I16Vec4 {
3015 type Output = Self;
3016 #[inline]
3017 fn shl(self, rhs: &UVec4) -> Self {
3018 self.shl(*rhs)
3019 }
3020}
3021
3022impl Shl<&UVec4> for &I16Vec4 {
3023 type Output = I16Vec4;
3024 #[inline]
3025 fn shl(self, rhs: &UVec4) -> I16Vec4 {
3026 (*self).shl(*rhs)
3027 }
3028}
3029
3030impl Shl<UVec4> for &I16Vec4 {
3031 type Output = I16Vec4;
3032 #[inline]
3033 fn shl(self, rhs: UVec4) -> I16Vec4 {
3034 (*self).shl(rhs)
3035 }
3036}
3037
3038impl Shr<UVec4> for I16Vec4 {
3039 type Output = Self;
3040 #[inline]
3041 fn shr(self, rhs: UVec4) -> Self {
3042 Self {
3043 x: self.x.shr(rhs.x),
3044 y: self.y.shr(rhs.y),
3045 z: self.z.shr(rhs.z),
3046 w: self.w.shr(rhs.w),
3047 }
3048 }
3049}
3050
3051impl Shr<&UVec4> for I16Vec4 {
3052 type Output = Self;
3053 #[inline]
3054 fn shr(self, rhs: &UVec4) -> Self {
3055 self.shr(*rhs)
3056 }
3057}
3058
3059impl Shr<&UVec4> for &I16Vec4 {
3060 type Output = I16Vec4;
3061 #[inline]
3062 fn shr(self, rhs: &UVec4) -> I16Vec4 {
3063 (*self).shr(*rhs)
3064 }
3065}
3066
3067impl Shr<UVec4> for &I16Vec4 {
3068 type Output = I16Vec4;
3069 #[inline]
3070 fn shr(self, rhs: UVec4) -> I16Vec4 {
3071 (*self).shr(rhs)
3072 }
3073}
3074
3075impl Index<usize> for I16Vec4 {
3076 type Output = i16;
3077 #[inline]
3078 fn index(&self, index: usize) -> &Self::Output {
3079 match index {
3080 0 => &self.x,
3081 1 => &self.y,
3082 2 => &self.z,
3083 3 => &self.w,
3084 _ => panic!("index out of bounds"),
3085 }
3086 }
3087}
3088
3089impl IndexMut<usize> for I16Vec4 {
3090 #[inline]
3091 fn index_mut(&mut self, index: usize) -> &mut Self::Output {
3092 match index {
3093 0 => &mut self.x,
3094 1 => &mut self.y,
3095 2 => &mut self.z,
3096 3 => &mut self.w,
3097 _ => panic!("index out of bounds"),
3098 }
3099 }
3100}
3101
3102impl fmt::Display for I16Vec4 {
3103 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3104 write!(f, "[{}, {}, {}, {}]", self.x, self.y, self.z, self.w)
3105 }
3106}
3107
3108impl fmt::Debug for I16Vec4 {
3109 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
3110 fmt.debug_tuple(stringify!(I16Vec4))
3111 .field(&self.x)
3112 .field(&self.y)
3113 .field(&self.z)
3114 .field(&self.w)
3115 .finish()
3116 }
3117}
3118
3119impl From<[i16; 4]> for I16Vec4 {
3120 #[inline]
3121 fn from(a: [i16; 4]) -> Self {
3122 Self::new(a[0], a[1], a[2], a[3])
3123 }
3124}
3125
3126impl From<I16Vec4> for [i16; 4] {
3127 #[inline]
3128 fn from(v: I16Vec4) -> Self {
3129 [v.x, v.y, v.z, v.w]
3130 }
3131}
3132
3133impl From<(i16, i16, i16, i16)> for I16Vec4 {
3134 #[inline]
3135 fn from(t: (i16, i16, i16, i16)) -> Self {
3136 Self::new(t.0, t.1, t.2, t.3)
3137 }
3138}
3139
3140impl From<I16Vec4> for (i16, i16, i16, i16) {
3141 #[inline]
3142 fn from(v: I16Vec4) -> Self {
3143 (v.x, v.y, v.z, v.w)
3144 }
3145}
3146
3147impl From<(I16Vec3, i16)> for I16Vec4 {
3148 #[inline]
3149 fn from((v, w): (I16Vec3, i16)) -> Self {
3150 Self::new(v.x, v.y, v.z, w)
3151 }
3152}
3153
3154impl From<(i16, I16Vec3)> for I16Vec4 {
3155 #[inline]
3156 fn from((x, v): (i16, I16Vec3)) -> Self {
3157 Self::new(x, v.x, v.y, v.z)
3158 }
3159}
3160
3161impl From<(I16Vec2, i16, i16)> for I16Vec4 {
3162 #[inline]
3163 fn from((v, z, w): (I16Vec2, i16, i16)) -> Self {
3164 Self::new(v.x, v.y, z, w)
3165 }
3166}
3167
3168impl From<(I16Vec2, I16Vec2)> for I16Vec4 {
3169 #[inline]
3170 fn from((v, u): (I16Vec2, I16Vec2)) -> Self {
3171 Self::new(v.x, v.y, u.x, u.y)
3172 }
3173}
3174
3175impl From<I8Vec4> for I16Vec4 {
3176 #[inline]
3177 fn from(v: I8Vec4) -> Self {
3178 Self::new(
3179 i16::from(v.x),
3180 i16::from(v.y),
3181 i16::from(v.z),
3182 i16::from(v.w),
3183 )
3184 }
3185}
3186
3187impl From<U8Vec4> for I16Vec4 {
3188 #[inline]
3189 fn from(v: U8Vec4) -> Self {
3190 Self::new(
3191 i16::from(v.x),
3192 i16::from(v.y),
3193 i16::from(v.z),
3194 i16::from(v.w),
3195 )
3196 }
3197}
3198
3199impl TryFrom<U16Vec4> for I16Vec4 {
3200 type Error = core::num::TryFromIntError;
3201
3202 #[inline]
3203 fn try_from(v: U16Vec4) -> Result<Self, Self::Error> {
3204 Ok(Self::new(
3205 i16::try_from(v.x)?,
3206 i16::try_from(v.y)?,
3207 i16::try_from(v.z)?,
3208 i16::try_from(v.w)?,
3209 ))
3210 }
3211}
3212
3213impl TryFrom<IVec4> for I16Vec4 {
3214 type Error = core::num::TryFromIntError;
3215
3216 #[inline]
3217 fn try_from(v: IVec4) -> Result<Self, Self::Error> {
3218 Ok(Self::new(
3219 i16::try_from(v.x)?,
3220 i16::try_from(v.y)?,
3221 i16::try_from(v.z)?,
3222 i16::try_from(v.w)?,
3223 ))
3224 }
3225}
3226
3227impl TryFrom<UVec4> for I16Vec4 {
3228 type Error = core::num::TryFromIntError;
3229
3230 #[inline]
3231 fn try_from(v: UVec4) -> Result<Self, Self::Error> {
3232 Ok(Self::new(
3233 i16::try_from(v.x)?,
3234 i16::try_from(v.y)?,
3235 i16::try_from(v.z)?,
3236 i16::try_from(v.w)?,
3237 ))
3238 }
3239}
3240
3241impl TryFrom<I64Vec4> for I16Vec4 {
3242 type Error = core::num::TryFromIntError;
3243
3244 #[inline]
3245 fn try_from(v: I64Vec4) -> Result<Self, Self::Error> {
3246 Ok(Self::new(
3247 i16::try_from(v.x)?,
3248 i16::try_from(v.y)?,
3249 i16::try_from(v.z)?,
3250 i16::try_from(v.w)?,
3251 ))
3252 }
3253}
3254
3255impl TryFrom<U64Vec4> for I16Vec4 {
3256 type Error = core::num::TryFromIntError;
3257
3258 #[inline]
3259 fn try_from(v: U64Vec4) -> Result<Self, Self::Error> {
3260 Ok(Self::new(
3261 i16::try_from(v.x)?,
3262 i16::try_from(v.y)?,
3263 i16::try_from(v.z)?,
3264 i16::try_from(v.w)?,
3265 ))
3266 }
3267}
3268
3269impl TryFrom<USizeVec4> for I16Vec4 {
3270 type Error = core::num::TryFromIntError;
3271
3272 #[inline]
3273 fn try_from(v: USizeVec4) -> Result<Self, Self::Error> {
3274 Ok(Self::new(
3275 i16::try_from(v.x)?,
3276 i16::try_from(v.y)?,
3277 i16::try_from(v.z)?,
3278 i16::try_from(v.w)?,
3279 ))
3280 }
3281}
3282
3283impl From<BVec4> for I16Vec4 {
3284 #[inline]
3285 fn from(v: BVec4) -> Self {
3286 Self::new(
3287 i16::from(v.x),
3288 i16::from(v.y),
3289 i16::from(v.z),
3290 i16::from(v.w),
3291 )
3292 }
3293}
3294
3295#[cfg(not(feature = "scalar-math"))]
3296impl From<BVec4A> for I16Vec4 {
3297 #[inline]
3298 fn from(v: BVec4A) -> Self {
3299 let bool_array: [bool; 4] = v.into();
3300 Self::new(
3301 i16::from(bool_array[0]),
3302 i16::from(bool_array[1]),
3303 i16::from(bool_array[2]),
3304 i16::from(bool_array[3]),
3305 )
3306 }
3307}