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