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