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