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