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