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