Skip to main content

glam/usize/
usizevec4.rs

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