Skip to main content

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