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