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