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