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