• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bitshifter / glam-rs / 24918269367

25 Apr 2026 12:40AM UTC coverage: 97.134%. Remained the same
24918269367

push

github

bitshifter
Add types are conditional.

57276 of 58966 relevant lines covered (97.13%)

3.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.71
/src/u8/u8vec4.rs
1
// Generated from vec.rs.tera template. Edit the template, not the generated file.
2

3
#[cfg(not(feature = "scalar-math"))]
4
use crate::BVec4A;
5
use crate::{BVec4, U8Vec2, U8Vec3};
6

7
#[cfg(feature = "i8")]
8
use crate::I8Vec4;
9

10
#[cfg(feature = "i16")]
11
use crate::I16Vec4;
12

13
#[cfg(feature = "u16")]
14
use crate::U16Vec4;
15

16
#[cfg(feature = "i32")]
17
use crate::IVec4;
18

19
#[cfg(feature = "u32")]
20
use crate::UVec4;
21

22
#[cfg(feature = "i64")]
23
use crate::I64Vec4;
24

25
#[cfg(feature = "u64")]
26
use crate::U64Vec4;
27

28
#[cfg(feature = "isize")]
29
use crate::ISizeVec4;
30

31
#[cfg(feature = "usize")]
32
use crate::USizeVec4;
33

34
use core::fmt;
35
use core::iter::{Product, Sum};
36
use core::{f32, ops::*};
37

38
#[cfg(feature = "zerocopy")]
39
use zerocopy_derive::*;
40

41
/// Creates a 4-dimensional vector.
42
#[inline(always)]
43
#[must_use]
44
pub const fn u8vec4(x: u8, y: u8, z: u8, w: u8) -> U8Vec4 {
6✔
45
    U8Vec4::new(x, y, z, w)
6✔
46
}
47

48
/// A 4-dimensional vector.
49
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
50
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
51
#[cfg_attr(
52
    feature = "zerocopy",
53
    derive(FromBytes, Immutable, IntoBytes, KnownLayout)
54
)]
55
#[cfg_attr(feature = "cuda", repr(align(4)))]
56
#[repr(C)]
57
#[cfg_attr(target_arch = "spirv", rust_gpu::vector::v1)]
58
pub struct U8Vec4 {
59
    pub x: u8,
60
    pub y: u8,
61
    pub z: u8,
62
    pub w: u8,
63
}
64

65
impl U8Vec4 {
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 `u8::MIN`.
73
    pub const MIN: Self = Self::splat(u8::MIN);
74

75
    /// All `u8::MAX`.
76
    pub const MAX: Self = Self::splat(u8::MAX);
77

78
    /// A unit vector pointing along the positive X axis.
79
    pub const X: Self = Self::new(1, 0, 0, 0);
80

81
    /// A unit vector pointing along the positive Y axis.
82
    pub const Y: Self = Self::new(0, 1, 0, 0);
83

84
    /// A unit vector pointing along the positive Z axis.
85
    pub const Z: Self = Self::new(0, 0, 1, 0);
86

87
    /// A unit vector pointing along the positive W axis.
88
    pub const W: Self = Self::new(0, 0, 0, 1);
89

90
    /// The unit axes.
91
    pub const AXES: [Self; 4] = [Self::X, Self::Y, Self::Z, Self::W];
92

93
    /// Creates a new vector.
94
    #[inline(always)]
95
    #[must_use]
96
    pub const fn new(x: u8, y: u8, z: u8, w: u8) -> Self {
12✔
97
        Self { x, y, z, w }
98
    }
99

100
    /// Creates a vector with all elements set to `v`.
101
    #[inline]
102
    #[must_use]
103
    pub const fn splat(v: u8) -> Self {
3✔
104
        Self {
105
            x: v,
106

107
            y: v,
108

109
            z: v,
110

111
            w: v,
112
        }
113
    }
114

115
    /// Returns a vector containing each element of `self` modified by a mapping function `f`.
116
    #[inline]
117
    #[must_use]
118
    pub fn map<F>(self, f: F) -> Self
6✔
119
    where
120
        F: Fn(u8) -> u8,
121
    {
122
        Self::new(f(self.x), f(self.y), f(self.z), f(self.w))
12✔
123
    }
124

125
    /// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use
126
    /// for each element of `self`.
127
    ///
128
    /// A true element in the mask uses the corresponding element from `if_true`, and false
129
    /// uses the element from `if_false`.
130
    #[inline]
131
    #[must_use]
132
    pub fn select(mask: BVec4, if_true: Self, if_false: Self) -> Self {
3✔
133
        Self {
134
            x: if mask.test(0) { if_true.x } else { if_false.x },
3✔
135
            y: if mask.test(1) { if_true.y } else { if_false.y },
3✔
136
            z: if mask.test(2) { if_true.z } else { if_false.z },
3✔
137
            w: if mask.test(3) { if_true.w } else { if_false.w },
3✔
138
        }
139
    }
140

141
    /// Creates a new vector from an array.
142
    #[inline]
143
    #[must_use]
144
    pub const fn from_array(a: [u8; 4]) -> Self {
×
145
        Self::new(a[0], a[1], a[2], a[3])
×
146
    }
147

148
    /// Converts `self` to `[x, y, z, w]`
149
    #[inline]
150
    #[must_use]
151
    pub const fn to_array(&self) -> [u8; 4] {
3✔
152
        [self.x, self.y, self.z, self.w]
3✔
153
    }
154

155
    /// Creates a vector from the first 4 values in `slice`.
156
    ///
157
    /// # Panics
158
    ///
159
    /// Panics if `slice` is less than 4 elements long.
160
    #[inline]
161
    #[must_use]
162
    pub const fn from_slice(slice: &[u8]) -> Self {
3✔
163
        assert!(slice.len() >= 4);
3✔
164
        Self::new(slice[0], slice[1], slice[2], slice[3])
6✔
165
    }
166

167
    /// Writes the elements of `self` to the first 4 elements in `slice`.
168
    ///
169
    /// # Panics
170
    ///
171
    /// Panics if `slice` is less than 4 elements long.
172
    #[inline]
173
    pub fn write_to_slice(self, slice: &mut [u8]) {
3✔
174
        slice[..4].copy_from_slice(&self.to_array());
3✔
175
    }
176

177
    /// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`.
178
    ///
179
    /// Truncation to [`U8Vec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()].
180
    #[inline]
181
    #[must_use]
182
    pub fn truncate(self) -> U8Vec3 {
6✔
183
        use crate::swizzles::Vec4Swizzles;
184
        self.xyz()
6✔
185
    }
186

187
    /// Creates a 4D vector from `self` with the given value of `x`.
188
    #[inline]
189
    #[must_use]
190
    pub fn with_x(mut self, x: u8) -> Self {
3✔
191
        self.x = x;
3✔
192
        self
3✔
193
    }
194

195
    /// Creates a 4D vector from `self` with the given value of `y`.
196
    #[inline]
197
    #[must_use]
198
    pub fn with_y(mut self, y: u8) -> Self {
3✔
199
        self.y = y;
3✔
200
        self
3✔
201
    }
202

203
    /// Creates a 4D vector from `self` with the given value of `z`.
204
    #[inline]
205
    #[must_use]
206
    pub fn with_z(mut self, z: u8) -> Self {
3✔
207
        self.z = z;
3✔
208
        self
3✔
209
    }
210

211
    /// Creates a 4D vector from `self` with the given value of `w`.
212
    #[inline]
213
    #[must_use]
214
    pub fn with_w(mut self, w: u8) -> Self {
3✔
215
        self.w = w;
3✔
216
        self
3✔
217
    }
218

219
    /// Computes the dot product of `self` and `rhs`.
220
    #[inline]
221
    #[must_use]
222
    pub fn dot(self, rhs: Self) -> u8 {
3✔
223
        (self.x * rhs.x) + (self.y * rhs.y) + (self.z * rhs.z) + (self.w * rhs.w)
3✔
224
    }
225

226
    /// Returns a vector where every component is the dot product of `self` and `rhs`.
227
    #[inline]
228
    #[must_use]
229
    pub fn dot_into_vec(self, rhs: Self) -> Self {
3✔
230
        Self::splat(self.dot(rhs))
3✔
231
    }
232

233
    /// Returns a vector containing the minimum values for each element of `self` and `rhs`.
234
    ///
235
    /// In other words this computes `[min(x, rhs.x), min(self.y, rhs.y), ..]`.
236
    #[inline]
237
    #[must_use]
238
    pub fn min(self, rhs: Self) -> Self {
3✔
239
        Self {
240
            x: if self.x < rhs.x { self.x } else { rhs.x },
3✔
241
            y: if self.y < rhs.y { self.y } else { rhs.y },
3✔
242
            z: if self.z < rhs.z { self.z } else { rhs.z },
3✔
243
            w: if self.w < rhs.w { self.w } else { rhs.w },
3✔
244
        }
245
    }
246

247
    /// Returns a vector containing the maximum values for each element of `self` and `rhs`.
248
    ///
249
    /// In other words this computes `[max(self.x, rhs.x), max(self.y, rhs.y), ..]`.
250
    #[inline]
251
    #[must_use]
252
    pub fn max(self, rhs: Self) -> Self {
3✔
253
        Self {
254
            x: if self.x > rhs.x { self.x } else { rhs.x },
3✔
255
            y: if self.y > rhs.y { self.y } else { rhs.y },
3✔
256
            z: if self.z > rhs.z { self.z } else { rhs.z },
3✔
257
            w: if self.w > rhs.w { self.w } else { rhs.w },
3✔
258
        }
259
    }
260

261
    /// Component-wise clamping of values, similar to [`u8::clamp`].
262
    ///
263
    /// Each element in `min` must be less-or-equal to the corresponding element in `max`.
264
    ///
265
    /// # Panics
266
    ///
267
    /// Will panic if `min` is greater than `max` when `glam_assert` is enabled.
268
    #[inline]
269
    #[must_use]
270
    pub fn clamp(self, min: Self, max: Self) -> Self {
3✔
271
        glam_assert!(min.cmple(max).all(), "clamp: expected min <= max");
3✔
272
        self.max(min).min(max)
3✔
273
    }
274

275
    /// Returns the horizontal minimum of `self`.
276
    ///
277
    /// In other words this computes `min(x, y, ..)`.
278
    #[inline]
279
    #[must_use]
280
    pub fn min_element(self) -> u8 {
3✔
281
        let min = |a, b| if a < b { a } else { b };
6✔
282
        min(self.x, min(self.y, min(self.z, self.w)))
3✔
283
    }
284

285
    /// Returns the horizontal maximum of `self`.
286
    ///
287
    /// In other words this computes `max(x, y, ..)`.
288
    #[inline]
289
    #[must_use]
290
    pub fn max_element(self) -> u8 {
3✔
291
        let max = |a, b| if a > b { a } else { b };
6✔
292
        max(self.x, max(self.y, max(self.z, self.w)))
3✔
293
    }
294

295
    /// Returns the index of the first minimum element of `self`.
296
    #[doc(alias = "argmin")]
297
    #[inline]
298
    #[must_use]
299
    pub fn min_position(self) -> usize {
3✔
300
        let mut min = self.x;
3✔
301
        let mut index = 0;
3✔
302
        if self.y < min {
6✔
303
            min = self.y;
3✔
304
            index = 1;
3✔
305
        }
306
        if self.z < min {
6✔
307
            min = self.z;
3✔
308
            index = 2;
3✔
309
        }
310
        if self.w < min {
6✔
311
            index = 3;
3✔
312
        }
313
        index
3✔
314
    }
315

316
    /// Returns the index of the first maximum element of `self`.
317
    #[doc(alias = "argmax")]
318
    #[inline]
319
    #[must_use]
320
    pub fn max_position(self) -> usize {
3✔
321
        let mut max = self.x;
3✔
322
        let mut index = 0;
3✔
323
        if self.y > max {
6✔
324
            max = self.y;
3✔
325
            index = 1;
3✔
326
        }
327
        if self.z > max {
6✔
328
            max = self.z;
3✔
329
            index = 2;
3✔
330
        }
331
        if self.w > max {
6✔
332
            index = 3;
3✔
333
        }
334
        index
3✔
335
    }
336

337
    /// Returns the sum of all elements of `self`.
338
    ///
339
    /// In other words, this computes `self.x + self.y + ..`.
340
    #[inline]
341
    #[must_use]
342
    pub fn element_sum(self) -> u8 {
3✔
343
        self.x + self.y + self.z + self.w
3✔
344
    }
345

346
    /// Returns the product of all elements of `self`.
347
    ///
348
    /// In other words, this computes `self.x * self.y * ..`.
349
    #[inline]
350
    #[must_use]
351
    pub fn element_product(self) -> u8 {
3✔
352
        self.x * self.y * self.z * self.w
3✔
353
    }
354

355
    /// Returns a vector mask containing the result of a `==` comparison for each element of
356
    /// `self` and `rhs`.
357
    ///
358
    /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all
359
    /// elements.
360
    #[inline]
361
    #[must_use]
362
    pub fn cmpeq(self, rhs: Self) -> BVec4 {
3✔
363
        BVec4::new(
364
            self.x.eq(&rhs.x),
3✔
365
            self.y.eq(&rhs.y),
3✔
366
            self.z.eq(&rhs.z),
3✔
367
            self.w.eq(&rhs.w),
3✔
368
        )
369
    }
370

371
    /// Returns a vector mask containing the result of a `!=` comparison for each element of
372
    /// `self` and `rhs`.
373
    ///
374
    /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all
375
    /// elements.
376
    #[inline]
377
    #[must_use]
378
    pub fn cmpne(self, rhs: Self) -> BVec4 {
3✔
379
        BVec4::new(
380
            self.x.ne(&rhs.x),
3✔
381
            self.y.ne(&rhs.y),
3✔
382
            self.z.ne(&rhs.z),
3✔
383
            self.w.ne(&rhs.w),
3✔
384
        )
385
    }
386

387
    /// Returns a vector mask containing the result of a `>=` comparison for each element of
388
    /// `self` and `rhs`.
389
    ///
390
    /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all
391
    /// elements.
392
    #[inline]
393
    #[must_use]
394
    pub fn cmpge(self, rhs: Self) -> BVec4 {
3✔
395
        BVec4::new(
396
            self.x.ge(&rhs.x),
3✔
397
            self.y.ge(&rhs.y),
3✔
398
            self.z.ge(&rhs.z),
3✔
399
            self.w.ge(&rhs.w),
3✔
400
        )
401
    }
402

403
    /// Returns a vector mask containing the result of a `>` comparison for each element of
404
    /// `self` and `rhs`.
405
    ///
406
    /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all
407
    /// elements.
408
    #[inline]
409
    #[must_use]
410
    pub fn cmpgt(self, rhs: Self) -> BVec4 {
3✔
411
        BVec4::new(
412
            self.x.gt(&rhs.x),
3✔
413
            self.y.gt(&rhs.y),
3✔
414
            self.z.gt(&rhs.z),
3✔
415
            self.w.gt(&rhs.w),
3✔
416
        )
417
    }
418

419
    /// Returns a vector mask containing the result of a `<=` comparison for each element of
420
    /// `self` and `rhs`.
421
    ///
422
    /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all
423
    /// elements.
424
    #[inline]
425
    #[must_use]
426
    pub fn cmple(self, rhs: Self) -> BVec4 {
6✔
427
        BVec4::new(
428
            self.x.le(&rhs.x),
6✔
429
            self.y.le(&rhs.y),
6✔
430
            self.z.le(&rhs.z),
6✔
431
            self.w.le(&rhs.w),
6✔
432
        )
433
    }
434

435
    /// Returns a vector mask containing the result of a `<` comparison for each element of
436
    /// `self` and `rhs`.
437
    ///
438
    /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all
439
    /// elements.
440
    #[inline]
441
    #[must_use]
442
    pub fn cmplt(self, rhs: Self) -> BVec4 {
3✔
443
        BVec4::new(
444
            self.x.lt(&rhs.x),
3✔
445
            self.y.lt(&rhs.y),
3✔
446
            self.z.lt(&rhs.z),
3✔
447
            self.w.lt(&rhs.w),
3✔
448
        )
449
    }
450

451
    /// Computes the squared length of `self`.
452
    #[doc(alias = "magnitude2")]
453
    #[inline]
454
    #[must_use]
455
    pub fn length_squared(self) -> u8 {
3✔
456
        self.dot(self)
3✔
457
    }
458

459
    /// Computes the [manhattan distance] between two points.
460
    ///
461
    /// # Overflow
462
    /// This method may overflow if the result is greater than [`u8::MAX`].
463
    ///
464
    /// See also [`checked_manhattan_distance`][U8Vec4::checked_manhattan_distance].
465
    ///
466
    /// [manhattan distance]: https://en.wikipedia.org/wiki/Taxicab_geometry
467
    #[inline]
468
    #[must_use]
469
    pub fn manhattan_distance(self, rhs: Self) -> u8 {
3✔
470
        self.x.abs_diff(rhs.x)
12✔
471
            + self.y.abs_diff(rhs.y)
3✔
472
            + self.z.abs_diff(rhs.z)
3✔
473
            + self.w.abs_diff(rhs.w)
3✔
474
    }
475

476
    /// Computes the [manhattan distance] between two points.
477
    ///
478
    /// This will returns [`None`] if the result is greater than [`u8::MAX`].
479
    ///
480
    /// [manhattan distance]: https://en.wikipedia.org/wiki/Taxicab_geometry
481
    #[inline]
482
    #[must_use]
483
    pub fn checked_manhattan_distance(self, rhs: Self) -> Option<u8> {
3✔
484
        let d = self.x.abs_diff(rhs.x);
3✔
485
        let d = d.checked_add(self.y.abs_diff(rhs.y))?;
3✔
486
        let d = d.checked_add(self.z.abs_diff(rhs.z))?;
3✔
487
        d.checked_add(self.w.abs_diff(rhs.w))
3✔
488
    }
489

490
    /// Computes the [chebyshev distance] between two points.
491
    ///
492
    /// [chebyshev distance]: https://en.wikipedia.org/wiki/Chebyshev_distance
493
    #[inline]
494
    #[must_use]
495
    pub fn chebyshev_distance(self, rhs: Self) -> u8 {
3✔
496
        // Note: the compiler will eventually optimize out the loop
497
        [
498
            self.x.abs_diff(rhs.x),
3✔
499
            self.y.abs_diff(rhs.y),
3✔
500
            self.z.abs_diff(rhs.z),
3✔
501
            self.w.abs_diff(rhs.w),
3✔
502
        ]
503
        .into_iter()
504
        .max()
505
        .unwrap()
506
    }
507

508
    /// Casts all elements of `self` to `f32`.
509
    #[inline]
510
    #[must_use]
511
    pub fn as_vec4(self) -> crate::Vec4 {
3✔
512
        crate::Vec4::new(self.x as f32, self.y as f32, self.z as f32, self.w as f32)
3✔
513
    }
514

515
    /// Casts all elements of `self` to `f64`.
516
    #[cfg(feature = "f64")]
517
    #[inline]
518
    #[must_use]
519
    pub fn as_dvec4(self) -> crate::DVec4 {
3✔
520
        crate::DVec4::new(self.x as f64, self.y as f64, self.z as f64, self.w as f64)
3✔
521
    }
522

523
    /// Casts all elements of `self` to `i8`.
524
    #[cfg(feature = "i8")]
525
    #[inline]
526
    #[must_use]
527
    pub fn as_i8vec4(self) -> crate::I8Vec4 {
3✔
528
        crate::I8Vec4::new(self.x as i8, self.y as i8, self.z as i8, self.w as i8)
3✔
529
    }
530

531
    /// Casts all elements of `self` to `i16`.
532
    #[cfg(feature = "i16")]
533
    #[inline]
534
    #[must_use]
535
    pub fn as_i16vec4(self) -> crate::I16Vec4 {
3✔
536
        crate::I16Vec4::new(self.x as i16, self.y as i16, self.z as i16, self.w as i16)
3✔
537
    }
538

539
    /// Casts all elements of `self` to `u16`.
540
    #[cfg(feature = "u16")]
541
    #[inline]
542
    #[must_use]
543
    pub fn as_u16vec4(self) -> crate::U16Vec4 {
3✔
544
        crate::U16Vec4::new(self.x as u16, self.y as u16, self.z as u16, self.w as u16)
3✔
545
    }
546

547
    /// Casts all elements of `self` to `i32`.
548
    #[cfg(feature = "i32")]
549
    #[inline]
550
    #[must_use]
551
    pub fn as_ivec4(self) -> crate::IVec4 {
3✔
552
        crate::IVec4::new(self.x as i32, self.y as i32, self.z as i32, self.w as i32)
3✔
553
    }
554

555
    /// Casts all elements of `self` to `u32`.
556
    #[cfg(feature = "u32")]
557
    #[inline]
558
    #[must_use]
559
    pub fn as_uvec4(self) -> crate::UVec4 {
3✔
560
        crate::UVec4::new(self.x as u32, self.y as u32, self.z as u32, self.w as u32)
3✔
561
    }
562

563
    /// Casts all elements of `self` to `i64`.
564
    #[cfg(feature = "i64")]
565
    #[inline]
566
    #[must_use]
567
    pub fn as_i64vec4(self) -> crate::I64Vec4 {
3✔
568
        crate::I64Vec4::new(self.x as i64, self.y as i64, self.z as i64, self.w as i64)
3✔
569
    }
570

571
    /// Casts all elements of `self` to `u64`.
572
    #[cfg(feature = "u64")]
573
    #[inline]
574
    #[must_use]
575
    pub fn as_u64vec4(self) -> crate::U64Vec4 {
3✔
576
        crate::U64Vec4::new(self.x as u64, self.y as u64, self.z as u64, self.w as u64)
3✔
577
    }
578

579
    /// Casts all elements of `self` to `isize`.
580
    #[cfg(feature = "isize")]
581
    #[inline]
582
    #[must_use]
583
    pub fn as_isizevec4(self) -> crate::ISizeVec4 {
3✔
584
        crate::ISizeVec4::new(
585
            self.x as isize,
3✔
586
            self.y as isize,
3✔
587
            self.z as isize,
3✔
588
            self.w as isize,
3✔
589
        )
590
    }
591

592
    /// Casts all elements of `self` to `usize`.
593
    #[cfg(feature = "usize")]
594
    #[inline]
595
    #[must_use]
596
    pub fn as_usizevec4(self) -> crate::USizeVec4 {
3✔
597
        crate::USizeVec4::new(
598
            self.x as usize,
3✔
599
            self.y as usize,
3✔
600
            self.z as usize,
3✔
601
            self.w as usize,
3✔
602
        )
603
    }
604

605
    /// Returns a vector containing the wrapping addition of `self` and `rhs`.
606
    ///
607
    /// In other words this computes `Some([self.x + rhs.x, self.y + rhs.y, ..])` but returns `None` on any overflow.
608
    #[inline]
609
    #[must_use]
610
    pub const fn checked_add(self, rhs: Self) -> Option<Self> {
3✔
611
        let x = match self.x.checked_add(rhs.x) {
3✔
612
            Some(v) => v,
3✔
613
            None => return None,
3✔
614
        };
615
        let y = match self.y.checked_add(rhs.y) {
3✔
616
            Some(v) => v,
3✔
617
            None => return None,
3✔
618
        };
619
        let z = match self.z.checked_add(rhs.z) {
3✔
620
            Some(v) => v,
3✔
621
            None => return None,
3✔
622
        };
623
        let w = match self.w.checked_add(rhs.w) {
3✔
624
            Some(v) => v,
3✔
625
            None => return None,
3✔
626
        };
627

628
        Some(Self { x, y, z, w })
3✔
629
    }
630

631
    /// Returns a vector containing the wrapping subtraction of `self` and `rhs`.
632
    ///
633
    /// In other words this computes `Some([self.x - rhs.x, self.y - rhs.y, ..])` but returns `None` on any overflow.
634
    #[inline]
635
    #[must_use]
636
    pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
3✔
637
        let x = match self.x.checked_sub(rhs.x) {
3✔
638
            Some(v) => v,
3✔
639
            None => return None,
3✔
640
        };
641
        let y = match self.y.checked_sub(rhs.y) {
3✔
642
            Some(v) => v,
3✔
643
            None => return None,
3✔
644
        };
645
        let z = match self.z.checked_sub(rhs.z) {
3✔
646
            Some(v) => v,
3✔
647
            None => return None,
3✔
648
        };
649
        let w = match self.w.checked_sub(rhs.w) {
3✔
650
            Some(v) => v,
3✔
651
            None => return None,
3✔
652
        };
653

654
        Some(Self { x, y, z, w })
3✔
655
    }
656

657
    /// Returns a vector containing the wrapping multiplication of `self` and `rhs`.
658
    ///
659
    /// In other words this computes `Some([self.x * rhs.x, self.y * rhs.y, ..])` but returns `None` on any overflow.
660
    #[inline]
661
    #[must_use]
662
    pub const fn checked_mul(self, rhs: Self) -> Option<Self> {
3✔
663
        let x = match self.x.checked_mul(rhs.x) {
3✔
664
            Some(v) => v,
3✔
665
            None => return None,
3✔
666
        };
667
        let y = match self.y.checked_mul(rhs.y) {
3✔
668
            Some(v) => v,
3✔
669
            None => return None,
×
670
        };
671
        let z = match self.z.checked_mul(rhs.z) {
3✔
672
            Some(v) => v,
3✔
673
            None => return None,
×
674
        };
675
        let w = match self.w.checked_mul(rhs.w) {
3✔
676
            Some(v) => v,
3✔
677
            None => return None,
×
678
        };
679

680
        Some(Self { x, y, z, w })
3✔
681
    }
682

683
    /// Returns a vector containing the wrapping division of `self` and `rhs`.
684
    ///
685
    /// In other words this computes `Some([self.x / rhs.x, self.y / rhs.y, ..])` but returns `None` on any division by zero.
686
    #[inline]
687
    #[must_use]
688
    pub const fn checked_div(self, rhs: Self) -> Option<Self> {
3✔
689
        let x = match self.x.checked_div(rhs.x) {
3✔
690
            Some(v) => v,
3✔
691
            None => return None,
3✔
692
        };
693
        let y = match self.y.checked_div(rhs.y) {
3✔
694
            Some(v) => v,
3✔
695
            None => return None,
3✔
696
        };
697
        let z = match self.z.checked_div(rhs.z) {
3✔
698
            Some(v) => v,
3✔
699
            None => return None,
×
700
        };
701
        let w = match self.w.checked_div(rhs.w) {
3✔
702
            Some(v) => v,
3✔
703
            None => return None,
×
704
        };
705

706
        Some(Self { x, y, z, w })
3✔
707
    }
708

709
    /// Returns a vector containing the wrapping addition of `self` and `rhs`.
710
    ///
711
    /// In other words this computes `[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]`.
712
    #[inline]
713
    #[must_use]
714
    pub const fn wrapping_add(self, rhs: Self) -> Self {
3✔
715
        Self {
716
            x: self.x.wrapping_add(rhs.x),
3✔
717
            y: self.y.wrapping_add(rhs.y),
3✔
718
            z: self.z.wrapping_add(rhs.z),
3✔
719
            w: self.w.wrapping_add(rhs.w),
3✔
720
        }
721
    }
722

723
    /// Returns a vector containing the wrapping subtraction of `self` and `rhs`.
724
    ///
725
    /// In other words this computes `[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]`.
726
    #[inline]
727
    #[must_use]
728
    pub const fn wrapping_sub(self, rhs: Self) -> Self {
3✔
729
        Self {
730
            x: self.x.wrapping_sub(rhs.x),
3✔
731
            y: self.y.wrapping_sub(rhs.y),
3✔
732
            z: self.z.wrapping_sub(rhs.z),
3✔
733
            w: self.w.wrapping_sub(rhs.w),
3✔
734
        }
735
    }
736

737
    /// Returns a vector containing the wrapping multiplication of `self` and `rhs`.
738
    ///
739
    /// In other words this computes `[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]`.
740
    #[inline]
741
    #[must_use]
742
    pub const fn wrapping_mul(self, rhs: Self) -> Self {
3✔
743
        Self {
744
            x: self.x.wrapping_mul(rhs.x),
3✔
745
            y: self.y.wrapping_mul(rhs.y),
3✔
746
            z: self.z.wrapping_mul(rhs.z),
3✔
747
            w: self.w.wrapping_mul(rhs.w),
3✔
748
        }
749
    }
750

751
    /// Returns a vector containing the wrapping division of `self` and `rhs`.
752
    ///
753
    /// In other words this computes `[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]`.
754
    #[inline]
755
    #[must_use]
756
    pub const fn wrapping_div(self, rhs: Self) -> Self {
3✔
757
        Self {
758
            x: self.x.wrapping_div(rhs.x),
3✔
759
            y: self.y.wrapping_div(rhs.y),
3✔
760
            z: self.z.wrapping_div(rhs.z),
3✔
761
            w: self.w.wrapping_div(rhs.w),
3✔
762
        }
763
    }
764

765
    /// Returns a vector containing the saturating addition of `self` and `rhs`.
766
    ///
767
    /// In other words this computes `[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]`.
768
    #[inline]
769
    #[must_use]
770
    pub const fn saturating_add(self, rhs: Self) -> Self {
3✔
771
        Self {
772
            x: self.x.saturating_add(rhs.x),
3✔
773
            y: self.y.saturating_add(rhs.y),
3✔
774
            z: self.z.saturating_add(rhs.z),
3✔
775
            w: self.w.saturating_add(rhs.w),
3✔
776
        }
777
    }
778

779
    /// Returns a vector containing the saturating subtraction of `self` and `rhs`.
780
    ///
781
    /// In other words this computes `[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]`.
782
    #[inline]
783
    #[must_use]
784
    pub const fn saturating_sub(self, rhs: Self) -> Self {
3✔
785
        Self {
786
            x: self.x.saturating_sub(rhs.x),
3✔
787
            y: self.y.saturating_sub(rhs.y),
3✔
788
            z: self.z.saturating_sub(rhs.z),
3✔
789
            w: self.w.saturating_sub(rhs.w),
3✔
790
        }
791
    }
792

793
    /// Returns a vector containing the saturating multiplication of `self` and `rhs`.
794
    ///
795
    /// In other words this computes `[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]`.
796
    #[inline]
797
    #[must_use]
798
    pub const fn saturating_mul(self, rhs: Self) -> Self {
3✔
799
        Self {
800
            x: self.x.saturating_mul(rhs.x),
3✔
801
            y: self.y.saturating_mul(rhs.y),
3✔
802
            z: self.z.saturating_mul(rhs.z),
3✔
803
            w: self.w.saturating_mul(rhs.w),
3✔
804
        }
805
    }
806

807
    /// Returns a vector containing the saturating division of `self` and `rhs`.
808
    ///
809
    /// In other words this computes `[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]`.
810
    #[inline]
811
    #[must_use]
812
    pub const fn saturating_div(self, rhs: Self) -> Self {
3✔
813
        Self {
814
            x: self.x.saturating_div(rhs.x),
3✔
815
            y: self.y.saturating_div(rhs.y),
3✔
816
            z: self.z.saturating_div(rhs.z),
3✔
817
            w: self.w.saturating_div(rhs.w),
3✔
818
        }
819
    }
820

821
    /// Returns a vector containing the wrapping addition of `self` and signed vector `rhs`.
822
    ///
823
    /// In other words this computes `Some([self.x + rhs.x, self.y + rhs.y, ..])` but returns `None` on any overflow.
824

825
    #[cfg(feature = "i8")]
826
    #[inline]
827
    #[must_use]
828
    pub const fn checked_add_signed(self, rhs: I8Vec4) -> Option<Self> {
3✔
829
        let x = match self.x.checked_add_signed(rhs.x) {
3✔
830
            Some(v) => v,
3✔
831
            None => return None,
3✔
832
        };
833
        let y = match self.y.checked_add_signed(rhs.y) {
3✔
834
            Some(v) => v,
3✔
835
            None => return None,
×
836
        };
837
        let z = match self.z.checked_add_signed(rhs.z) {
3✔
838
            Some(v) => v,
3✔
839
            None => return None,
×
840
        };
841
        let w = match self.w.checked_add_signed(rhs.w) {
3✔
842
            Some(v) => v,
3✔
843
            None => return None,
×
844
        };
845

846
        Some(Self { x, y, z, w })
3✔
847
    }
848

849
    /// Returns a vector containing the wrapping addition of `self` and signed vector `rhs`.
850
    ///
851
    /// In other words this computes `[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]`.
852

853
    #[cfg(feature = "i8")]
854
    #[inline]
855
    #[must_use]
856
    pub const fn wrapping_add_signed(self, rhs: I8Vec4) -> Self {
3✔
857
        Self {
858
            x: self.x.wrapping_add_signed(rhs.x),
3✔
859
            y: self.y.wrapping_add_signed(rhs.y),
3✔
860
            z: self.z.wrapping_add_signed(rhs.z),
3✔
861
            w: self.w.wrapping_add_signed(rhs.w),
3✔
862
        }
863
    }
864

865
    /// Returns a vector containing the saturating addition of `self` and signed vector `rhs`.
866
    ///
867
    /// In other words this computes `[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]`.
868

869
    #[cfg(feature = "i8")]
870
    #[inline]
871
    #[must_use]
872
    pub const fn saturating_add_signed(self, rhs: I8Vec4) -> Self {
3✔
873
        Self {
874
            x: self.x.saturating_add_signed(rhs.x),
3✔
875
            y: self.y.saturating_add_signed(rhs.y),
3✔
876
            z: self.z.saturating_add_signed(rhs.z),
3✔
877
            w: self.w.saturating_add_signed(rhs.w),
3✔
878
        }
879
    }
880
}
881

882
impl Default for U8Vec4 {
883
    #[inline(always)]
884
    fn default() -> Self {
×
885
        Self::ZERO
6✔
886
    }
887
}
888

889
impl Div for U8Vec4 {
890
    type Output = Self;
891
    #[inline]
892
    fn div(self, rhs: Self) -> Self {
3✔
893
        Self {
894
            x: self.x.div(rhs.x),
3✔
895
            y: self.y.div(rhs.y),
3✔
896
            z: self.z.div(rhs.z),
3✔
897
            w: self.w.div(rhs.w),
3✔
898
        }
899
    }
900
}
901

902
impl Div<&Self> for U8Vec4 {
903
    type Output = Self;
904
    #[inline]
905
    fn div(self, rhs: &Self) -> Self {
3✔
906
        self.div(*rhs)
3✔
907
    }
908
}
909

910
impl Div<&U8Vec4> for &U8Vec4 {
911
    type Output = U8Vec4;
912
    #[inline]
913
    fn div(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
914
        (*self).div(*rhs)
3✔
915
    }
916
}
917

918
impl Div<U8Vec4> for &U8Vec4 {
919
    type Output = U8Vec4;
920
    #[inline]
921
    fn div(self, rhs: U8Vec4) -> U8Vec4 {
3✔
922
        (*self).div(rhs)
3✔
923
    }
924
}
925

926
impl DivAssign for U8Vec4 {
927
    #[inline]
928
    fn div_assign(&mut self, rhs: Self) {
3✔
929
        self.x.div_assign(rhs.x);
3✔
930
        self.y.div_assign(rhs.y);
4✔
931
        self.z.div_assign(rhs.z);
4✔
932
        self.w.div_assign(rhs.w);
4✔
933
    }
934
}
935

936
impl DivAssign<&Self> for U8Vec4 {
937
    #[inline]
938
    fn div_assign(&mut self, rhs: &Self) {
3✔
939
        self.div_assign(*rhs);
3✔
940
    }
941
}
942

943
impl Div<u8> for U8Vec4 {
944
    type Output = Self;
945
    #[inline]
946
    fn div(self, rhs: u8) -> Self {
6✔
947
        Self {
948
            x: self.x.div(rhs),
6✔
949
            y: self.y.div(rhs),
6✔
950
            z: self.z.div(rhs),
6✔
951
            w: self.w.div(rhs),
6✔
952
        }
953
    }
954
}
955

956
impl Div<&u8> for U8Vec4 {
957
    type Output = Self;
958
    #[inline]
959
    fn div(self, rhs: &u8) -> Self {
3✔
960
        self.div(*rhs)
3✔
961
    }
962
}
963

964
impl Div<&u8> for &U8Vec4 {
965
    type Output = U8Vec4;
966
    #[inline]
967
    fn div(self, rhs: &u8) -> U8Vec4 {
3✔
968
        (*self).div(*rhs)
3✔
969
    }
970
}
971

972
impl Div<u8> for &U8Vec4 {
973
    type Output = U8Vec4;
974
    #[inline]
975
    fn div(self, rhs: u8) -> U8Vec4 {
3✔
976
        (*self).div(rhs)
3✔
977
    }
978
}
979

980
impl DivAssign<u8> for U8Vec4 {
981
    #[inline]
982
    fn div_assign(&mut self, rhs: u8) {
3✔
983
        self.x.div_assign(rhs);
3✔
984
        self.y.div_assign(rhs);
3✔
985
        self.z.div_assign(rhs);
4✔
986
        self.w.div_assign(rhs);
4✔
987
    }
988
}
989

990
impl DivAssign<&u8> for U8Vec4 {
991
    #[inline]
992
    fn div_assign(&mut self, rhs: &u8) {
3✔
993
        self.div_assign(*rhs);
3✔
994
    }
995
}
996

997
impl Div<U8Vec4> for u8 {
998
    type Output = U8Vec4;
999
    #[inline]
1000
    fn div(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1001
        U8Vec4 {
1002
            x: self.div(rhs.x),
3✔
1003
            y: self.div(rhs.y),
3✔
1004
            z: self.div(rhs.z),
3✔
1005
            w: self.div(rhs.w),
3✔
1006
        }
1007
    }
1008
}
1009

1010
impl Div<&U8Vec4> for u8 {
1011
    type Output = U8Vec4;
1012
    #[inline]
1013
    fn div(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1014
        self.div(*rhs)
3✔
1015
    }
1016
}
1017

1018
impl Div<&U8Vec4> for &u8 {
1019
    type Output = U8Vec4;
1020
    #[inline]
1021
    fn div(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1022
        (*self).div(*rhs)
3✔
1023
    }
1024
}
1025

1026
impl Div<U8Vec4> for &u8 {
1027
    type Output = U8Vec4;
1028
    #[inline]
1029
    fn div(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1030
        (*self).div(rhs)
3✔
1031
    }
1032
}
1033

1034
impl Mul for U8Vec4 {
1035
    type Output = Self;
1036
    #[inline]
1037
    fn mul(self, rhs: Self) -> Self {
3✔
1038
        Self {
1039
            x: self.x.mul(rhs.x),
3✔
1040
            y: self.y.mul(rhs.y),
3✔
1041
            z: self.z.mul(rhs.z),
3✔
1042
            w: self.w.mul(rhs.w),
3✔
1043
        }
1044
    }
1045
}
1046

1047
impl Mul<&Self> for U8Vec4 {
1048
    type Output = Self;
1049
    #[inline]
1050
    fn mul(self, rhs: &Self) -> Self {
3✔
1051
        self.mul(*rhs)
3✔
1052
    }
1053
}
1054

1055
impl Mul<&U8Vec4> for &U8Vec4 {
1056
    type Output = U8Vec4;
1057
    #[inline]
1058
    fn mul(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1059
        (*self).mul(*rhs)
3✔
1060
    }
1061
}
1062

1063
impl Mul<U8Vec4> for &U8Vec4 {
1064
    type Output = U8Vec4;
1065
    #[inline]
1066
    fn mul(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1067
        (*self).mul(rhs)
3✔
1068
    }
1069
}
1070

1071
impl MulAssign for U8Vec4 {
1072
    #[inline]
1073
    fn mul_assign(&mut self, rhs: Self) {
3✔
1074
        self.x.mul_assign(rhs.x);
3✔
1075
        self.y.mul_assign(rhs.y);
4✔
1076
        self.z.mul_assign(rhs.z);
4✔
1077
        self.w.mul_assign(rhs.w);
4✔
1078
    }
1079
}
1080

1081
impl MulAssign<&Self> for U8Vec4 {
1082
    #[inline]
1083
    fn mul_assign(&mut self, rhs: &Self) {
3✔
1084
        self.mul_assign(*rhs);
3✔
1085
    }
1086
}
1087

1088
impl Mul<u8> for U8Vec4 {
1089
    type Output = Self;
1090
    #[inline]
1091
    fn mul(self, rhs: u8) -> Self {
3✔
1092
        Self {
1093
            x: self.x.mul(rhs),
3✔
1094
            y: self.y.mul(rhs),
3✔
1095
            z: self.z.mul(rhs),
3✔
1096
            w: self.w.mul(rhs),
3✔
1097
        }
1098
    }
1099
}
1100

1101
impl Mul<&u8> for U8Vec4 {
1102
    type Output = Self;
1103
    #[inline]
1104
    fn mul(self, rhs: &u8) -> Self {
3✔
1105
        self.mul(*rhs)
3✔
1106
    }
1107
}
1108

1109
impl Mul<&u8> for &U8Vec4 {
1110
    type Output = U8Vec4;
1111
    #[inline]
1112
    fn mul(self, rhs: &u8) -> U8Vec4 {
3✔
1113
        (*self).mul(*rhs)
3✔
1114
    }
1115
}
1116

1117
impl Mul<u8> for &U8Vec4 {
1118
    type Output = U8Vec4;
1119
    #[inline]
1120
    fn mul(self, rhs: u8) -> U8Vec4 {
3✔
1121
        (*self).mul(rhs)
3✔
1122
    }
1123
}
1124

1125
impl MulAssign<u8> for U8Vec4 {
1126
    #[inline]
1127
    fn mul_assign(&mut self, rhs: u8) {
3✔
1128
        self.x.mul_assign(rhs);
3✔
1129
        self.y.mul_assign(rhs);
3✔
1130
        self.z.mul_assign(rhs);
3✔
1131
        self.w.mul_assign(rhs);
3✔
1132
    }
1133
}
1134

1135
impl MulAssign<&u8> for U8Vec4 {
1136
    #[inline]
1137
    fn mul_assign(&mut self, rhs: &u8) {
3✔
1138
        self.mul_assign(*rhs);
3✔
1139
    }
1140
}
1141

1142
impl Mul<U8Vec4> for u8 {
1143
    type Output = U8Vec4;
1144
    #[inline]
1145
    fn mul(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1146
        U8Vec4 {
1147
            x: self.mul(rhs.x),
3✔
1148
            y: self.mul(rhs.y),
3✔
1149
            z: self.mul(rhs.z),
3✔
1150
            w: self.mul(rhs.w),
3✔
1151
        }
1152
    }
1153
}
1154

1155
impl Mul<&U8Vec4> for u8 {
1156
    type Output = U8Vec4;
1157
    #[inline]
1158
    fn mul(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1159
        self.mul(*rhs)
3✔
1160
    }
1161
}
1162

1163
impl Mul<&U8Vec4> for &u8 {
1164
    type Output = U8Vec4;
1165
    #[inline]
1166
    fn mul(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1167
        (*self).mul(*rhs)
3✔
1168
    }
1169
}
1170

1171
impl Mul<U8Vec4> for &u8 {
1172
    type Output = U8Vec4;
1173
    #[inline]
1174
    fn mul(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1175
        (*self).mul(rhs)
3✔
1176
    }
1177
}
1178

1179
impl Add for U8Vec4 {
1180
    type Output = Self;
1181
    #[inline]
1182
    fn add(self, rhs: Self) -> Self {
3✔
1183
        Self {
1184
            x: self.x.add(rhs.x),
3✔
1185
            y: self.y.add(rhs.y),
3✔
1186
            z: self.z.add(rhs.z),
3✔
1187
            w: self.w.add(rhs.w),
3✔
1188
        }
1189
    }
1190
}
1191

1192
impl Add<&Self> for U8Vec4 {
1193
    type Output = Self;
1194
    #[inline]
1195
    fn add(self, rhs: &Self) -> Self {
3✔
1196
        self.add(*rhs)
3✔
1197
    }
1198
}
1199

1200
impl Add<&U8Vec4> for &U8Vec4 {
1201
    type Output = U8Vec4;
1202
    #[inline]
1203
    fn add(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1204
        (*self).add(*rhs)
3✔
1205
    }
1206
}
1207

1208
impl Add<U8Vec4> for &U8Vec4 {
1209
    type Output = U8Vec4;
1210
    #[inline]
1211
    fn add(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1212
        (*self).add(rhs)
3✔
1213
    }
1214
}
1215

1216
impl AddAssign for U8Vec4 {
1217
    #[inline]
1218
    fn add_assign(&mut self, rhs: Self) {
3✔
1219
        self.x.add_assign(rhs.x);
3✔
1220
        self.y.add_assign(rhs.y);
6✔
1221
        self.z.add_assign(rhs.z);
6✔
1222
        self.w.add_assign(rhs.w);
6✔
1223
    }
1224
}
1225

1226
impl AddAssign<&Self> for U8Vec4 {
1227
    #[inline]
1228
    fn add_assign(&mut self, rhs: &Self) {
3✔
1229
        self.add_assign(*rhs);
3✔
1230
    }
1231
}
1232

1233
impl Add<u8> for U8Vec4 {
1234
    type Output = Self;
1235
    #[inline]
1236
    fn add(self, rhs: u8) -> Self {
3✔
1237
        Self {
1238
            x: self.x.add(rhs),
3✔
1239
            y: self.y.add(rhs),
3✔
1240
            z: self.z.add(rhs),
3✔
1241
            w: self.w.add(rhs),
3✔
1242
        }
1243
    }
1244
}
1245

1246
impl Add<&u8> for U8Vec4 {
1247
    type Output = Self;
1248
    #[inline]
1249
    fn add(self, rhs: &u8) -> Self {
3✔
1250
        self.add(*rhs)
3✔
1251
    }
1252
}
1253

1254
impl Add<&u8> for &U8Vec4 {
1255
    type Output = U8Vec4;
1256
    #[inline]
1257
    fn add(self, rhs: &u8) -> U8Vec4 {
3✔
1258
        (*self).add(*rhs)
3✔
1259
    }
1260
}
1261

1262
impl Add<u8> for &U8Vec4 {
1263
    type Output = U8Vec4;
1264
    #[inline]
1265
    fn add(self, rhs: u8) -> U8Vec4 {
3✔
1266
        (*self).add(rhs)
3✔
1267
    }
1268
}
1269

1270
impl AddAssign<u8> for U8Vec4 {
1271
    #[inline]
1272
    fn add_assign(&mut self, rhs: u8) {
3✔
1273
        self.x.add_assign(rhs);
3✔
1274
        self.y.add_assign(rhs);
3✔
1275
        self.z.add_assign(rhs);
3✔
1276
        self.w.add_assign(rhs);
3✔
1277
    }
1278
}
1279

1280
impl AddAssign<&u8> for U8Vec4 {
1281
    #[inline]
1282
    fn add_assign(&mut self, rhs: &u8) {
3✔
1283
        self.add_assign(*rhs);
3✔
1284
    }
1285
}
1286

1287
impl Add<U8Vec4> for u8 {
1288
    type Output = U8Vec4;
1289
    #[inline]
1290
    fn add(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1291
        U8Vec4 {
1292
            x: self.add(rhs.x),
3✔
1293
            y: self.add(rhs.y),
3✔
1294
            z: self.add(rhs.z),
3✔
1295
            w: self.add(rhs.w),
3✔
1296
        }
1297
    }
1298
}
1299

1300
impl Add<&U8Vec4> for u8 {
1301
    type Output = U8Vec4;
1302
    #[inline]
1303
    fn add(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1304
        self.add(*rhs)
3✔
1305
    }
1306
}
1307

1308
impl Add<&U8Vec4> for &u8 {
1309
    type Output = U8Vec4;
1310
    #[inline]
1311
    fn add(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1312
        (*self).add(*rhs)
3✔
1313
    }
1314
}
1315

1316
impl Add<U8Vec4> for &u8 {
1317
    type Output = U8Vec4;
1318
    #[inline]
1319
    fn add(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1320
        (*self).add(rhs)
3✔
1321
    }
1322
}
1323

1324
impl Sub for U8Vec4 {
1325
    type Output = Self;
1326
    #[inline]
1327
    fn sub(self, rhs: Self) -> Self {
3✔
1328
        Self {
1329
            x: self.x.sub(rhs.x),
3✔
1330
            y: self.y.sub(rhs.y),
3✔
1331
            z: self.z.sub(rhs.z),
3✔
1332
            w: self.w.sub(rhs.w),
3✔
1333
        }
1334
    }
1335
}
1336

1337
impl Sub<&Self> for U8Vec4 {
1338
    type Output = Self;
1339
    #[inline]
1340
    fn sub(self, rhs: &Self) -> Self {
3✔
1341
        self.sub(*rhs)
3✔
1342
    }
1343
}
1344

1345
impl Sub<&U8Vec4> for &U8Vec4 {
1346
    type Output = U8Vec4;
1347
    #[inline]
1348
    fn sub(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1349
        (*self).sub(*rhs)
3✔
1350
    }
1351
}
1352

1353
impl Sub<U8Vec4> for &U8Vec4 {
1354
    type Output = U8Vec4;
1355
    #[inline]
1356
    fn sub(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1357
        (*self).sub(rhs)
3✔
1358
    }
1359
}
1360

1361
impl SubAssign for U8Vec4 {
1362
    #[inline]
1363
    fn sub_assign(&mut self, rhs: Self) {
3✔
1364
        self.x.sub_assign(rhs.x);
3✔
1365
        self.y.sub_assign(rhs.y);
6✔
1366
        self.z.sub_assign(rhs.z);
5✔
1367
        self.w.sub_assign(rhs.w);
5✔
1368
    }
1369
}
1370

1371
impl SubAssign<&Self> for U8Vec4 {
1372
    #[inline]
1373
    fn sub_assign(&mut self, rhs: &Self) {
3✔
1374
        self.sub_assign(*rhs);
3✔
1375
    }
1376
}
1377

1378
impl Sub<u8> for U8Vec4 {
1379
    type Output = Self;
1380
    #[inline]
1381
    fn sub(self, rhs: u8) -> Self {
3✔
1382
        Self {
1383
            x: self.x.sub(rhs),
3✔
1384
            y: self.y.sub(rhs),
3✔
1385
            z: self.z.sub(rhs),
3✔
1386
            w: self.w.sub(rhs),
3✔
1387
        }
1388
    }
1389
}
1390

1391
impl Sub<&u8> for U8Vec4 {
1392
    type Output = Self;
1393
    #[inline]
1394
    fn sub(self, rhs: &u8) -> Self {
3✔
1395
        self.sub(*rhs)
3✔
1396
    }
1397
}
1398

1399
impl Sub<&u8> for &U8Vec4 {
1400
    type Output = U8Vec4;
1401
    #[inline]
1402
    fn sub(self, rhs: &u8) -> U8Vec4 {
3✔
1403
        (*self).sub(*rhs)
3✔
1404
    }
1405
}
1406

1407
impl Sub<u8> for &U8Vec4 {
1408
    type Output = U8Vec4;
1409
    #[inline]
1410
    fn sub(self, rhs: u8) -> U8Vec4 {
3✔
1411
        (*self).sub(rhs)
3✔
1412
    }
1413
}
1414

1415
impl SubAssign<u8> for U8Vec4 {
1416
    #[inline]
1417
    fn sub_assign(&mut self, rhs: u8) {
3✔
1418
        self.x.sub_assign(rhs);
3✔
1419
        self.y.sub_assign(rhs);
3✔
1420
        self.z.sub_assign(rhs);
3✔
1421
        self.w.sub_assign(rhs);
3✔
1422
    }
1423
}
1424

1425
impl SubAssign<&u8> for U8Vec4 {
1426
    #[inline]
1427
    fn sub_assign(&mut self, rhs: &u8) {
3✔
1428
        self.sub_assign(*rhs);
3✔
1429
    }
1430
}
1431

1432
impl Sub<U8Vec4> for u8 {
1433
    type Output = U8Vec4;
1434
    #[inline]
1435
    fn sub(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1436
        U8Vec4 {
1437
            x: self.sub(rhs.x),
3✔
1438
            y: self.sub(rhs.y),
3✔
1439
            z: self.sub(rhs.z),
3✔
1440
            w: self.sub(rhs.w),
3✔
1441
        }
1442
    }
1443
}
1444

1445
impl Sub<&U8Vec4> for u8 {
1446
    type Output = U8Vec4;
1447
    #[inline]
1448
    fn sub(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1449
        self.sub(*rhs)
3✔
1450
    }
1451
}
1452

1453
impl Sub<&U8Vec4> for &u8 {
1454
    type Output = U8Vec4;
1455
    #[inline]
1456
    fn sub(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1457
        (*self).sub(*rhs)
3✔
1458
    }
1459
}
1460

1461
impl Sub<U8Vec4> for &u8 {
1462
    type Output = U8Vec4;
1463
    #[inline]
1464
    fn sub(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1465
        (*self).sub(rhs)
3✔
1466
    }
1467
}
1468

1469
impl Rem for U8Vec4 {
1470
    type Output = Self;
1471
    #[inline]
1472
    fn rem(self, rhs: Self) -> Self {
3✔
1473
        Self {
1474
            x: self.x.rem(rhs.x),
3✔
1475
            y: self.y.rem(rhs.y),
3✔
1476
            z: self.z.rem(rhs.z),
3✔
1477
            w: self.w.rem(rhs.w),
3✔
1478
        }
1479
    }
1480
}
1481

1482
impl Rem<&Self> for U8Vec4 {
1483
    type Output = Self;
1484
    #[inline]
1485
    fn rem(self, rhs: &Self) -> Self {
3✔
1486
        self.rem(*rhs)
3✔
1487
    }
1488
}
1489

1490
impl Rem<&U8Vec4> for &U8Vec4 {
1491
    type Output = U8Vec4;
1492
    #[inline]
1493
    fn rem(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1494
        (*self).rem(*rhs)
3✔
1495
    }
1496
}
1497

1498
impl Rem<U8Vec4> for &U8Vec4 {
1499
    type Output = U8Vec4;
1500
    #[inline]
1501
    fn rem(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1502
        (*self).rem(rhs)
3✔
1503
    }
1504
}
1505

1506
impl RemAssign for U8Vec4 {
1507
    #[inline]
1508
    fn rem_assign(&mut self, rhs: Self) {
3✔
1509
        self.x.rem_assign(rhs.x);
3✔
1510
        self.y.rem_assign(rhs.y);
3✔
1511
        self.z.rem_assign(rhs.z);
4✔
1512
        self.w.rem_assign(rhs.w);
4✔
1513
    }
1514
}
1515

1516
impl RemAssign<&Self> for U8Vec4 {
1517
    #[inline]
1518
    fn rem_assign(&mut self, rhs: &Self) {
3✔
1519
        self.rem_assign(*rhs);
3✔
1520
    }
1521
}
1522

1523
impl Rem<u8> for U8Vec4 {
1524
    type Output = Self;
1525
    #[inline]
1526
    fn rem(self, rhs: u8) -> Self {
3✔
1527
        Self {
1528
            x: self.x.rem(rhs),
3✔
1529
            y: self.y.rem(rhs),
3✔
1530
            z: self.z.rem(rhs),
3✔
1531
            w: self.w.rem(rhs),
3✔
1532
        }
1533
    }
1534
}
1535

1536
impl Rem<&u8> for U8Vec4 {
1537
    type Output = Self;
1538
    #[inline]
1539
    fn rem(self, rhs: &u8) -> Self {
3✔
1540
        self.rem(*rhs)
3✔
1541
    }
1542
}
1543

1544
impl Rem<&u8> for &U8Vec4 {
1545
    type Output = U8Vec4;
1546
    #[inline]
1547
    fn rem(self, rhs: &u8) -> U8Vec4 {
3✔
1548
        (*self).rem(*rhs)
3✔
1549
    }
1550
}
1551

1552
impl Rem<u8> for &U8Vec4 {
1553
    type Output = U8Vec4;
1554
    #[inline]
1555
    fn rem(self, rhs: u8) -> U8Vec4 {
3✔
1556
        (*self).rem(rhs)
3✔
1557
    }
1558
}
1559

1560
impl RemAssign<u8> for U8Vec4 {
1561
    #[inline]
1562
    fn rem_assign(&mut self, rhs: u8) {
3✔
1563
        self.x.rem_assign(rhs);
3✔
1564
        self.y.rem_assign(rhs);
5✔
1565
        self.z.rem_assign(rhs);
6✔
1566
        self.w.rem_assign(rhs);
6✔
1567
    }
1568
}
1569

1570
impl RemAssign<&u8> for U8Vec4 {
1571
    #[inline]
1572
    fn rem_assign(&mut self, rhs: &u8) {
3✔
1573
        self.rem_assign(*rhs);
3✔
1574
    }
1575
}
1576

1577
impl Rem<U8Vec4> for u8 {
1578
    type Output = U8Vec4;
1579
    #[inline]
1580
    fn rem(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1581
        U8Vec4 {
1582
            x: self.rem(rhs.x),
3✔
1583
            y: self.rem(rhs.y),
3✔
1584
            z: self.rem(rhs.z),
3✔
1585
            w: self.rem(rhs.w),
3✔
1586
        }
1587
    }
1588
}
1589

1590
impl Rem<&U8Vec4> for u8 {
1591
    type Output = U8Vec4;
1592
    #[inline]
1593
    fn rem(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1594
        self.rem(*rhs)
3✔
1595
    }
1596
}
1597

1598
impl Rem<&U8Vec4> for &u8 {
1599
    type Output = U8Vec4;
1600
    #[inline]
1601
    fn rem(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1602
        (*self).rem(*rhs)
3✔
1603
    }
1604
}
1605

1606
impl Rem<U8Vec4> for &u8 {
1607
    type Output = U8Vec4;
1608
    #[inline]
1609
    fn rem(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1610
        (*self).rem(rhs)
3✔
1611
    }
1612
}
1613

1614
impl AsRef<[u8; 4]> for U8Vec4 {
1615
    #[inline]
1616
    fn as_ref(&self) -> &[u8; 4] {
3✔
1617
        unsafe { &*(self as *const Self as *const [u8; 4]) }
3✔
1618
    }
1619
}
1620

1621
impl AsMut<[u8; 4]> for U8Vec4 {
1622
    #[inline]
1623
    fn as_mut(&mut self) -> &mut [u8; 4] {
3✔
1624
        unsafe { &mut *(self as *mut Self as *mut [u8; 4]) }
3✔
1625
    }
1626
}
1627

1628
impl Sum for U8Vec4 {
1629
    #[inline]
1630
    fn sum<I>(iter: I) -> Self
3✔
1631
    where
1632
        I: Iterator<Item = Self>,
1633
    {
1634
        iter.fold(Self::ZERO, Self::add)
3✔
1635
    }
1636
}
1637

1638
impl<'a> Sum<&'a Self> for U8Vec4 {
1639
    #[inline]
1640
    fn sum<I>(iter: I) -> Self
3✔
1641
    where
1642
        I: Iterator<Item = &'a Self>,
1643
    {
1644
        iter.fold(Self::ZERO, |a, &b| Self::add(a, b))
9✔
1645
    }
1646
}
1647

1648
impl Product for U8Vec4 {
1649
    #[inline]
1650
    fn product<I>(iter: I) -> Self
3✔
1651
    where
1652
        I: Iterator<Item = Self>,
1653
    {
1654
        iter.fold(Self::ONE, Self::mul)
3✔
1655
    }
1656
}
1657

1658
impl<'a> Product<&'a Self> for U8Vec4 {
1659
    #[inline]
1660
    fn product<I>(iter: I) -> Self
3✔
1661
    where
1662
        I: Iterator<Item = &'a Self>,
1663
    {
1664
        iter.fold(Self::ONE, |a, &b| Self::mul(a, b))
9✔
1665
    }
1666
}
1667

1668
impl Not for U8Vec4 {
1669
    type Output = Self;
1670
    #[inline]
1671
    fn not(self) -> Self {
3✔
1672
        Self {
1673
            x: self.x.not(),
3✔
1674
            y: self.y.not(),
3✔
1675
            z: self.z.not(),
3✔
1676
            w: self.w.not(),
3✔
1677
        }
1678
    }
1679
}
1680

1681
impl Not for &U8Vec4 {
1682
    type Output = U8Vec4;
1683
    #[inline]
1684
    fn not(self) -> U8Vec4 {
3✔
1685
        (*self).not()
3✔
1686
    }
1687
}
1688

1689
impl BitAnd for U8Vec4 {
1690
    type Output = Self;
1691
    #[inline]
1692
    fn bitand(self, rhs: Self) -> Self::Output {
3✔
1693
        Self {
1694
            x: self.x.bitand(rhs.x),
3✔
1695
            y: self.y.bitand(rhs.y),
3✔
1696
            z: self.z.bitand(rhs.z),
3✔
1697
            w: self.w.bitand(rhs.w),
3✔
1698
        }
1699
    }
1700
}
1701

1702
impl BitAnd<&Self> for U8Vec4 {
1703
    type Output = Self;
1704
    #[inline]
1705
    fn bitand(self, rhs: &Self) -> Self {
3✔
1706
        self.bitand(*rhs)
3✔
1707
    }
1708
}
1709

1710
impl BitAnd<&U8Vec4> for &U8Vec4 {
1711
    type Output = U8Vec4;
1712
    #[inline]
1713
    fn bitand(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1714
        (*self).bitand(*rhs)
3✔
1715
    }
1716
}
1717

1718
impl BitAnd<U8Vec4> for &U8Vec4 {
1719
    type Output = U8Vec4;
1720
    #[inline]
1721
    fn bitand(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1722
        (*self).bitand(rhs)
3✔
1723
    }
1724
}
1725

1726
impl BitAndAssign for U8Vec4 {
1727
    #[inline]
1728
    fn bitand_assign(&mut self, rhs: Self) {
3✔
1729
        *self = self.bitand(rhs);
3✔
1730
    }
1731
}
1732

1733
impl BitAndAssign<&Self> for U8Vec4 {
1734
    #[inline]
1735
    fn bitand_assign(&mut self, rhs: &Self) {
3✔
1736
        self.bitand_assign(*rhs);
3✔
1737
    }
1738
}
1739

1740
impl BitOr for U8Vec4 {
1741
    type Output = Self;
1742
    #[inline]
1743
    fn bitor(self, rhs: Self) -> Self::Output {
3✔
1744
        Self {
1745
            x: self.x.bitor(rhs.x),
3✔
1746
            y: self.y.bitor(rhs.y),
3✔
1747
            z: self.z.bitor(rhs.z),
3✔
1748
            w: self.w.bitor(rhs.w),
3✔
1749
        }
1750
    }
1751
}
1752

1753
impl BitOr<&Self> for U8Vec4 {
1754
    type Output = Self;
1755
    #[inline]
1756
    fn bitor(self, rhs: &Self) -> Self {
3✔
1757
        self.bitor(*rhs)
3✔
1758
    }
1759
}
1760

1761
impl BitOr<&U8Vec4> for &U8Vec4 {
1762
    type Output = U8Vec4;
1763
    #[inline]
1764
    fn bitor(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1765
        (*self).bitor(*rhs)
3✔
1766
    }
1767
}
1768

1769
impl BitOr<U8Vec4> for &U8Vec4 {
1770
    type Output = U8Vec4;
1771
    #[inline]
1772
    fn bitor(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1773
        (*self).bitor(rhs)
3✔
1774
    }
1775
}
1776

1777
impl BitOrAssign for U8Vec4 {
1778
    #[inline]
1779
    fn bitor_assign(&mut self, rhs: Self) {
3✔
1780
        *self = self.bitor(rhs);
3✔
1781
    }
1782
}
1783

1784
impl BitOrAssign<&Self> for U8Vec4 {
1785
    #[inline]
1786
    fn bitor_assign(&mut self, rhs: &Self) {
3✔
1787
        self.bitor_assign(*rhs);
3✔
1788
    }
1789
}
1790

1791
impl BitXor for U8Vec4 {
1792
    type Output = Self;
1793
    #[inline]
1794
    fn bitxor(self, rhs: Self) -> Self::Output {
3✔
1795
        Self {
1796
            x: self.x.bitxor(rhs.x),
3✔
1797
            y: self.y.bitxor(rhs.y),
3✔
1798
            z: self.z.bitxor(rhs.z),
3✔
1799
            w: self.w.bitxor(rhs.w),
3✔
1800
        }
1801
    }
1802
}
1803

1804
impl BitXor<&Self> for U8Vec4 {
1805
    type Output = Self;
1806
    #[inline]
1807
    fn bitxor(self, rhs: &Self) -> Self {
3✔
1808
        self.bitxor(*rhs)
3✔
1809
    }
1810
}
1811

1812
impl BitXor<&U8Vec4> for &U8Vec4 {
1813
    type Output = U8Vec4;
1814
    #[inline]
1815
    fn bitxor(self, rhs: &U8Vec4) -> U8Vec4 {
3✔
1816
        (*self).bitxor(*rhs)
3✔
1817
    }
1818
}
1819

1820
impl BitXor<U8Vec4> for &U8Vec4 {
1821
    type Output = U8Vec4;
1822
    #[inline]
1823
    fn bitxor(self, rhs: U8Vec4) -> U8Vec4 {
3✔
1824
        (*self).bitxor(rhs)
3✔
1825
    }
1826
}
1827

1828
impl BitXorAssign for U8Vec4 {
1829
    #[inline]
1830
    fn bitxor_assign(&mut self, rhs: Self) {
3✔
1831
        *self = self.bitxor(rhs);
3✔
1832
    }
1833
}
1834

1835
impl BitXorAssign<&Self> for U8Vec4 {
1836
    #[inline]
1837
    fn bitxor_assign(&mut self, rhs: &Self) {
3✔
1838
        self.bitxor_assign(*rhs);
3✔
1839
    }
1840
}
1841

1842
impl BitAnd<u8> for U8Vec4 {
1843
    type Output = Self;
1844
    #[inline]
1845
    fn bitand(self, rhs: u8) -> Self::Output {
3✔
1846
        Self {
1847
            x: self.x.bitand(rhs),
3✔
1848
            y: self.y.bitand(rhs),
3✔
1849
            z: self.z.bitand(rhs),
3✔
1850
            w: self.w.bitand(rhs),
3✔
1851
        }
1852
    }
1853
}
1854

1855
impl BitAnd<&u8> for U8Vec4 {
1856
    type Output = Self;
1857
    #[inline]
1858
    fn bitand(self, rhs: &u8) -> Self {
3✔
1859
        self.bitand(*rhs)
3✔
1860
    }
1861
}
1862

1863
impl BitAnd<&u8> for &U8Vec4 {
1864
    type Output = U8Vec4;
1865
    #[inline]
1866
    fn bitand(self, rhs: &u8) -> U8Vec4 {
3✔
1867
        (*self).bitand(*rhs)
3✔
1868
    }
1869
}
1870

1871
impl BitAnd<u8> for &U8Vec4 {
1872
    type Output = U8Vec4;
1873
    #[inline]
1874
    fn bitand(self, rhs: u8) -> U8Vec4 {
3✔
1875
        (*self).bitand(rhs)
3✔
1876
    }
1877
}
1878

1879
impl BitAndAssign<u8> for U8Vec4 {
1880
    #[inline]
1881
    fn bitand_assign(&mut self, rhs: u8) {
3✔
1882
        *self = self.bitand(rhs);
3✔
1883
    }
1884
}
1885

1886
impl BitAndAssign<&u8> for U8Vec4 {
1887
    #[inline]
1888
    fn bitand_assign(&mut self, rhs: &u8) {
3✔
1889
        self.bitand_assign(*rhs);
3✔
1890
    }
1891
}
1892

1893
impl BitOr<u8> for U8Vec4 {
1894
    type Output = Self;
1895
    #[inline]
1896
    fn bitor(self, rhs: u8) -> Self::Output {
3✔
1897
        Self {
1898
            x: self.x.bitor(rhs),
3✔
1899
            y: self.y.bitor(rhs),
3✔
1900
            z: self.z.bitor(rhs),
3✔
1901
            w: self.w.bitor(rhs),
3✔
1902
        }
1903
    }
1904
}
1905

1906
impl BitOr<&u8> for U8Vec4 {
1907
    type Output = Self;
1908
    #[inline]
1909
    fn bitor(self, rhs: &u8) -> Self {
3✔
1910
        self.bitor(*rhs)
3✔
1911
    }
1912
}
1913

1914
impl BitOr<&u8> for &U8Vec4 {
1915
    type Output = U8Vec4;
1916
    #[inline]
1917
    fn bitor(self, rhs: &u8) -> U8Vec4 {
3✔
1918
        (*self).bitor(*rhs)
3✔
1919
    }
1920
}
1921

1922
impl BitOr<u8> for &U8Vec4 {
1923
    type Output = U8Vec4;
1924
    #[inline]
1925
    fn bitor(self, rhs: u8) -> U8Vec4 {
3✔
1926
        (*self).bitor(rhs)
3✔
1927
    }
1928
}
1929

1930
impl BitOrAssign<u8> for U8Vec4 {
1931
    #[inline]
1932
    fn bitor_assign(&mut self, rhs: u8) {
3✔
1933
        *self = self.bitor(rhs);
3✔
1934
    }
1935
}
1936

1937
impl BitOrAssign<&u8> for U8Vec4 {
1938
    #[inline]
1939
    fn bitor_assign(&mut self, rhs: &u8) {
3✔
1940
        self.bitor_assign(*rhs);
3✔
1941
    }
1942
}
1943

1944
impl BitXor<u8> for U8Vec4 {
1945
    type Output = Self;
1946
    #[inline]
1947
    fn bitxor(self, rhs: u8) -> Self::Output {
3✔
1948
        Self {
1949
            x: self.x.bitxor(rhs),
3✔
1950
            y: self.y.bitxor(rhs),
3✔
1951
            z: self.z.bitxor(rhs),
3✔
1952
            w: self.w.bitxor(rhs),
3✔
1953
        }
1954
    }
1955
}
1956

1957
impl BitXor<&u8> for U8Vec4 {
1958
    type Output = Self;
1959
    #[inline]
1960
    fn bitxor(self, rhs: &u8) -> Self {
3✔
1961
        self.bitxor(*rhs)
3✔
1962
    }
1963
}
1964

1965
impl BitXor<&u8> for &U8Vec4 {
1966
    type Output = U8Vec4;
1967
    #[inline]
1968
    fn bitxor(self, rhs: &u8) -> U8Vec4 {
3✔
1969
        (*self).bitxor(*rhs)
3✔
1970
    }
1971
}
1972

1973
impl BitXor<u8> for &U8Vec4 {
1974
    type Output = U8Vec4;
1975
    #[inline]
1976
    fn bitxor(self, rhs: u8) -> U8Vec4 {
3✔
1977
        (*self).bitxor(rhs)
3✔
1978
    }
1979
}
1980

1981
impl BitXorAssign<u8> for U8Vec4 {
1982
    #[inline]
1983
    fn bitxor_assign(&mut self, rhs: u8) {
3✔
1984
        *self = self.bitxor(rhs);
3✔
1985
    }
1986
}
1987

1988
impl BitXorAssign<&u8> for U8Vec4 {
1989
    #[inline]
1990
    fn bitxor_assign(&mut self, rhs: &u8) {
3✔
1991
        self.bitxor_assign(*rhs);
3✔
1992
    }
1993
}
1994

1995
impl Shl<i8> for U8Vec4 {
1996
    type Output = Self;
1997
    #[inline]
1998
    fn shl(self, rhs: i8) -> Self::Output {
3✔
1999
        Self {
2000
            x: self.x.shl(rhs),
3✔
2001
            y: self.y.shl(rhs),
3✔
2002
            z: self.z.shl(rhs),
3✔
2003
            w: self.w.shl(rhs),
3✔
2004
        }
2005
    }
2006
}
2007

2008
impl Shl<&i8> for U8Vec4 {
2009
    type Output = Self;
2010
    #[inline]
2011
    fn shl(self, rhs: &i8) -> Self {
3✔
2012
        self.shl(*rhs)
3✔
2013
    }
2014
}
2015

2016
impl Shl<&i8> for &U8Vec4 {
2017
    type Output = U8Vec4;
2018
    #[inline]
2019
    fn shl(self, rhs: &i8) -> U8Vec4 {
3✔
2020
        (*self).shl(*rhs)
3✔
2021
    }
2022
}
2023

2024
impl Shl<i8> for &U8Vec4 {
2025
    type Output = U8Vec4;
2026
    #[inline]
2027
    fn shl(self, rhs: i8) -> U8Vec4 {
3✔
2028
        (*self).shl(rhs)
3✔
2029
    }
2030
}
2031

2032
impl ShlAssign<i8> for U8Vec4 {
2033
    #[inline]
2034
    fn shl_assign(&mut self, rhs: i8) {
3✔
2035
        *self = self.shl(rhs);
3✔
2036
    }
2037
}
2038

2039
impl ShlAssign<&i8> for U8Vec4 {
2040
    #[inline]
2041
    fn shl_assign(&mut self, rhs: &i8) {
3✔
2042
        self.shl_assign(*rhs);
3✔
2043
    }
2044
}
2045

2046
impl Shr<i8> for U8Vec4 {
2047
    type Output = Self;
2048
    #[inline]
2049
    fn shr(self, rhs: i8) -> Self::Output {
3✔
2050
        Self {
2051
            x: self.x.shr(rhs),
3✔
2052
            y: self.y.shr(rhs),
3✔
2053
            z: self.z.shr(rhs),
3✔
2054
            w: self.w.shr(rhs),
3✔
2055
        }
2056
    }
2057
}
2058

2059
impl Shr<&i8> for U8Vec4 {
2060
    type Output = Self;
2061
    #[inline]
2062
    fn shr(self, rhs: &i8) -> Self {
3✔
2063
        self.shr(*rhs)
3✔
2064
    }
2065
}
2066

2067
impl Shr<&i8> for &U8Vec4 {
2068
    type Output = U8Vec4;
2069
    #[inline]
2070
    fn shr(self, rhs: &i8) -> U8Vec4 {
3✔
2071
        (*self).shr(*rhs)
3✔
2072
    }
2073
}
2074

2075
impl Shr<i8> for &U8Vec4 {
2076
    type Output = U8Vec4;
2077
    #[inline]
2078
    fn shr(self, rhs: i8) -> U8Vec4 {
3✔
2079
        (*self).shr(rhs)
3✔
2080
    }
2081
}
2082

2083
impl ShrAssign<i8> for U8Vec4 {
2084
    #[inline]
2085
    fn shr_assign(&mut self, rhs: i8) {
3✔
2086
        *self = self.shr(rhs);
3✔
2087
    }
2088
}
2089

2090
impl ShrAssign<&i8> for U8Vec4 {
2091
    #[inline]
2092
    fn shr_assign(&mut self, rhs: &i8) {
3✔
2093
        self.shr_assign(*rhs);
3✔
2094
    }
2095
}
2096

2097
impl Shl<i16> for U8Vec4 {
2098
    type Output = Self;
2099
    #[inline]
2100
    fn shl(self, rhs: i16) -> Self::Output {
3✔
2101
        Self {
2102
            x: self.x.shl(rhs),
3✔
2103
            y: self.y.shl(rhs),
3✔
2104
            z: self.z.shl(rhs),
3✔
2105
            w: self.w.shl(rhs),
3✔
2106
        }
2107
    }
2108
}
2109

2110
impl Shl<&i16> for U8Vec4 {
2111
    type Output = Self;
2112
    #[inline]
2113
    fn shl(self, rhs: &i16) -> Self {
3✔
2114
        self.shl(*rhs)
3✔
2115
    }
2116
}
2117

2118
impl Shl<&i16> for &U8Vec4 {
2119
    type Output = U8Vec4;
2120
    #[inline]
2121
    fn shl(self, rhs: &i16) -> U8Vec4 {
3✔
2122
        (*self).shl(*rhs)
3✔
2123
    }
2124
}
2125

2126
impl Shl<i16> for &U8Vec4 {
2127
    type Output = U8Vec4;
2128
    #[inline]
2129
    fn shl(self, rhs: i16) -> U8Vec4 {
3✔
2130
        (*self).shl(rhs)
3✔
2131
    }
2132
}
2133

2134
impl ShlAssign<i16> for U8Vec4 {
2135
    #[inline]
2136
    fn shl_assign(&mut self, rhs: i16) {
3✔
2137
        *self = self.shl(rhs);
3✔
2138
    }
2139
}
2140

2141
impl ShlAssign<&i16> for U8Vec4 {
2142
    #[inline]
2143
    fn shl_assign(&mut self, rhs: &i16) {
3✔
2144
        self.shl_assign(*rhs);
3✔
2145
    }
2146
}
2147

2148
impl Shr<i16> for U8Vec4 {
2149
    type Output = Self;
2150
    #[inline]
2151
    fn shr(self, rhs: i16) -> Self::Output {
3✔
2152
        Self {
2153
            x: self.x.shr(rhs),
3✔
2154
            y: self.y.shr(rhs),
3✔
2155
            z: self.z.shr(rhs),
3✔
2156
            w: self.w.shr(rhs),
3✔
2157
        }
2158
    }
2159
}
2160

2161
impl Shr<&i16> for U8Vec4 {
2162
    type Output = Self;
2163
    #[inline]
2164
    fn shr(self, rhs: &i16) -> Self {
3✔
2165
        self.shr(*rhs)
3✔
2166
    }
2167
}
2168

2169
impl Shr<&i16> for &U8Vec4 {
2170
    type Output = U8Vec4;
2171
    #[inline]
2172
    fn shr(self, rhs: &i16) -> U8Vec4 {
3✔
2173
        (*self).shr(*rhs)
3✔
2174
    }
2175
}
2176

2177
impl Shr<i16> for &U8Vec4 {
2178
    type Output = U8Vec4;
2179
    #[inline]
2180
    fn shr(self, rhs: i16) -> U8Vec4 {
3✔
2181
        (*self).shr(rhs)
3✔
2182
    }
2183
}
2184

2185
impl ShrAssign<i16> for U8Vec4 {
2186
    #[inline]
2187
    fn shr_assign(&mut self, rhs: i16) {
3✔
2188
        *self = self.shr(rhs);
3✔
2189
    }
2190
}
2191

2192
impl ShrAssign<&i16> for U8Vec4 {
2193
    #[inline]
2194
    fn shr_assign(&mut self, rhs: &i16) {
3✔
2195
        self.shr_assign(*rhs);
3✔
2196
    }
2197
}
2198

2199
impl Shl<i32> for U8Vec4 {
2200
    type Output = Self;
2201
    #[inline]
2202
    fn shl(self, rhs: i32) -> Self::Output {
3✔
2203
        Self {
2204
            x: self.x.shl(rhs),
3✔
2205
            y: self.y.shl(rhs),
3✔
2206
            z: self.z.shl(rhs),
3✔
2207
            w: self.w.shl(rhs),
3✔
2208
        }
2209
    }
2210
}
2211

2212
impl Shl<&i32> for U8Vec4 {
2213
    type Output = Self;
2214
    #[inline]
2215
    fn shl(self, rhs: &i32) -> Self {
3✔
2216
        self.shl(*rhs)
3✔
2217
    }
2218
}
2219

2220
impl Shl<&i32> for &U8Vec4 {
2221
    type Output = U8Vec4;
2222
    #[inline]
2223
    fn shl(self, rhs: &i32) -> U8Vec4 {
3✔
2224
        (*self).shl(*rhs)
3✔
2225
    }
2226
}
2227

2228
impl Shl<i32> for &U8Vec4 {
2229
    type Output = U8Vec4;
2230
    #[inline]
2231
    fn shl(self, rhs: i32) -> U8Vec4 {
3✔
2232
        (*self).shl(rhs)
3✔
2233
    }
2234
}
2235

2236
impl ShlAssign<i32> for U8Vec4 {
2237
    #[inline]
2238
    fn shl_assign(&mut self, rhs: i32) {
3✔
2239
        *self = self.shl(rhs);
3✔
2240
    }
2241
}
2242

2243
impl ShlAssign<&i32> for U8Vec4 {
2244
    #[inline]
2245
    fn shl_assign(&mut self, rhs: &i32) {
3✔
2246
        self.shl_assign(*rhs);
3✔
2247
    }
2248
}
2249

2250
impl Shr<i32> for U8Vec4 {
2251
    type Output = Self;
2252
    #[inline]
2253
    fn shr(self, rhs: i32) -> Self::Output {
3✔
2254
        Self {
2255
            x: self.x.shr(rhs),
3✔
2256
            y: self.y.shr(rhs),
3✔
2257
            z: self.z.shr(rhs),
3✔
2258
            w: self.w.shr(rhs),
3✔
2259
        }
2260
    }
2261
}
2262

2263
impl Shr<&i32> for U8Vec4 {
2264
    type Output = Self;
2265
    #[inline]
2266
    fn shr(self, rhs: &i32) -> Self {
3✔
2267
        self.shr(*rhs)
3✔
2268
    }
2269
}
2270

2271
impl Shr<&i32> for &U8Vec4 {
2272
    type Output = U8Vec4;
2273
    #[inline]
2274
    fn shr(self, rhs: &i32) -> U8Vec4 {
3✔
2275
        (*self).shr(*rhs)
3✔
2276
    }
2277
}
2278

2279
impl Shr<i32> for &U8Vec4 {
2280
    type Output = U8Vec4;
2281
    #[inline]
2282
    fn shr(self, rhs: i32) -> U8Vec4 {
3✔
2283
        (*self).shr(rhs)
3✔
2284
    }
2285
}
2286

2287
impl ShrAssign<i32> for U8Vec4 {
2288
    #[inline]
2289
    fn shr_assign(&mut self, rhs: i32) {
3✔
2290
        *self = self.shr(rhs);
3✔
2291
    }
2292
}
2293

2294
impl ShrAssign<&i32> for U8Vec4 {
2295
    #[inline]
2296
    fn shr_assign(&mut self, rhs: &i32) {
3✔
2297
        self.shr_assign(*rhs);
3✔
2298
    }
2299
}
2300

2301
impl Shl<i64> for U8Vec4 {
2302
    type Output = Self;
2303
    #[inline]
2304
    fn shl(self, rhs: i64) -> Self::Output {
3✔
2305
        Self {
2306
            x: self.x.shl(rhs),
3✔
2307
            y: self.y.shl(rhs),
3✔
2308
            z: self.z.shl(rhs),
3✔
2309
            w: self.w.shl(rhs),
3✔
2310
        }
2311
    }
2312
}
2313

2314
impl Shl<&i64> for U8Vec4 {
2315
    type Output = Self;
2316
    #[inline]
2317
    fn shl(self, rhs: &i64) -> Self {
3✔
2318
        self.shl(*rhs)
3✔
2319
    }
2320
}
2321

2322
impl Shl<&i64> for &U8Vec4 {
2323
    type Output = U8Vec4;
2324
    #[inline]
2325
    fn shl(self, rhs: &i64) -> U8Vec4 {
3✔
2326
        (*self).shl(*rhs)
3✔
2327
    }
2328
}
2329

2330
impl Shl<i64> for &U8Vec4 {
2331
    type Output = U8Vec4;
2332
    #[inline]
2333
    fn shl(self, rhs: i64) -> U8Vec4 {
3✔
2334
        (*self).shl(rhs)
3✔
2335
    }
2336
}
2337

2338
impl ShlAssign<i64> for U8Vec4 {
2339
    #[inline]
2340
    fn shl_assign(&mut self, rhs: i64) {
3✔
2341
        *self = self.shl(rhs);
3✔
2342
    }
2343
}
2344

2345
impl ShlAssign<&i64> for U8Vec4 {
2346
    #[inline]
2347
    fn shl_assign(&mut self, rhs: &i64) {
3✔
2348
        self.shl_assign(*rhs);
3✔
2349
    }
2350
}
2351

2352
impl Shr<i64> for U8Vec4 {
2353
    type Output = Self;
2354
    #[inline]
2355
    fn shr(self, rhs: i64) -> Self::Output {
3✔
2356
        Self {
2357
            x: self.x.shr(rhs),
3✔
2358
            y: self.y.shr(rhs),
3✔
2359
            z: self.z.shr(rhs),
3✔
2360
            w: self.w.shr(rhs),
3✔
2361
        }
2362
    }
2363
}
2364

2365
impl Shr<&i64> for U8Vec4 {
2366
    type Output = Self;
2367
    #[inline]
2368
    fn shr(self, rhs: &i64) -> Self {
3✔
2369
        self.shr(*rhs)
3✔
2370
    }
2371
}
2372

2373
impl Shr<&i64> for &U8Vec4 {
2374
    type Output = U8Vec4;
2375
    #[inline]
2376
    fn shr(self, rhs: &i64) -> U8Vec4 {
3✔
2377
        (*self).shr(*rhs)
3✔
2378
    }
2379
}
2380

2381
impl Shr<i64> for &U8Vec4 {
2382
    type Output = U8Vec4;
2383
    #[inline]
2384
    fn shr(self, rhs: i64) -> U8Vec4 {
3✔
2385
        (*self).shr(rhs)
3✔
2386
    }
2387
}
2388

2389
impl ShrAssign<i64> for U8Vec4 {
2390
    #[inline]
2391
    fn shr_assign(&mut self, rhs: i64) {
3✔
2392
        *self = self.shr(rhs);
3✔
2393
    }
2394
}
2395

2396
impl ShrAssign<&i64> for U8Vec4 {
2397
    #[inline]
2398
    fn shr_assign(&mut self, rhs: &i64) {
3✔
2399
        self.shr_assign(*rhs);
3✔
2400
    }
2401
}
2402

2403
impl Shl<u8> for U8Vec4 {
2404
    type Output = Self;
2405
    #[inline]
2406
    fn shl(self, rhs: u8) -> Self::Output {
3✔
2407
        Self {
2408
            x: self.x.shl(rhs),
3✔
2409
            y: self.y.shl(rhs),
3✔
2410
            z: self.z.shl(rhs),
3✔
2411
            w: self.w.shl(rhs),
3✔
2412
        }
2413
    }
2414
}
2415

2416
impl Shl<&u8> for U8Vec4 {
2417
    type Output = Self;
2418
    #[inline]
2419
    fn shl(self, rhs: &u8) -> Self {
3✔
2420
        self.shl(*rhs)
3✔
2421
    }
2422
}
2423

2424
impl Shl<&u8> for &U8Vec4 {
2425
    type Output = U8Vec4;
2426
    #[inline]
2427
    fn shl(self, rhs: &u8) -> U8Vec4 {
3✔
2428
        (*self).shl(*rhs)
3✔
2429
    }
2430
}
2431

2432
impl Shl<u8> for &U8Vec4 {
2433
    type Output = U8Vec4;
2434
    #[inline]
2435
    fn shl(self, rhs: u8) -> U8Vec4 {
3✔
2436
        (*self).shl(rhs)
3✔
2437
    }
2438
}
2439

2440
impl ShlAssign<u8> for U8Vec4 {
2441
    #[inline]
2442
    fn shl_assign(&mut self, rhs: u8) {
3✔
2443
        *self = self.shl(rhs);
3✔
2444
    }
2445
}
2446

2447
impl ShlAssign<&u8> for U8Vec4 {
2448
    #[inline]
2449
    fn shl_assign(&mut self, rhs: &u8) {
3✔
2450
        self.shl_assign(*rhs);
3✔
2451
    }
2452
}
2453

2454
impl Shr<u8> for U8Vec4 {
2455
    type Output = Self;
2456
    #[inline]
2457
    fn shr(self, rhs: u8) -> Self::Output {
3✔
2458
        Self {
2459
            x: self.x.shr(rhs),
3✔
2460
            y: self.y.shr(rhs),
3✔
2461
            z: self.z.shr(rhs),
3✔
2462
            w: self.w.shr(rhs),
3✔
2463
        }
2464
    }
2465
}
2466

2467
impl Shr<&u8> for U8Vec4 {
2468
    type Output = Self;
2469
    #[inline]
2470
    fn shr(self, rhs: &u8) -> Self {
3✔
2471
        self.shr(*rhs)
3✔
2472
    }
2473
}
2474

2475
impl Shr<&u8> for &U8Vec4 {
2476
    type Output = U8Vec4;
2477
    #[inline]
2478
    fn shr(self, rhs: &u8) -> U8Vec4 {
3✔
2479
        (*self).shr(*rhs)
3✔
2480
    }
2481
}
2482

2483
impl Shr<u8> for &U8Vec4 {
2484
    type Output = U8Vec4;
2485
    #[inline]
2486
    fn shr(self, rhs: u8) -> U8Vec4 {
3✔
2487
        (*self).shr(rhs)
3✔
2488
    }
2489
}
2490

2491
impl ShrAssign<u8> for U8Vec4 {
2492
    #[inline]
2493
    fn shr_assign(&mut self, rhs: u8) {
3✔
2494
        *self = self.shr(rhs);
3✔
2495
    }
2496
}
2497

2498
impl ShrAssign<&u8> for U8Vec4 {
2499
    #[inline]
2500
    fn shr_assign(&mut self, rhs: &u8) {
3✔
2501
        self.shr_assign(*rhs);
3✔
2502
    }
2503
}
2504

2505
impl Shl<u16> for U8Vec4 {
2506
    type Output = Self;
2507
    #[inline]
2508
    fn shl(self, rhs: u16) -> Self::Output {
3✔
2509
        Self {
2510
            x: self.x.shl(rhs),
3✔
2511
            y: self.y.shl(rhs),
3✔
2512
            z: self.z.shl(rhs),
3✔
2513
            w: self.w.shl(rhs),
3✔
2514
        }
2515
    }
2516
}
2517

2518
impl Shl<&u16> for U8Vec4 {
2519
    type Output = Self;
2520
    #[inline]
2521
    fn shl(self, rhs: &u16) -> Self {
3✔
2522
        self.shl(*rhs)
3✔
2523
    }
2524
}
2525

2526
impl Shl<&u16> for &U8Vec4 {
2527
    type Output = U8Vec4;
2528
    #[inline]
2529
    fn shl(self, rhs: &u16) -> U8Vec4 {
3✔
2530
        (*self).shl(*rhs)
3✔
2531
    }
2532
}
2533

2534
impl Shl<u16> for &U8Vec4 {
2535
    type Output = U8Vec4;
2536
    #[inline]
2537
    fn shl(self, rhs: u16) -> U8Vec4 {
3✔
2538
        (*self).shl(rhs)
3✔
2539
    }
2540
}
2541

2542
impl ShlAssign<u16> for U8Vec4 {
2543
    #[inline]
2544
    fn shl_assign(&mut self, rhs: u16) {
3✔
2545
        *self = self.shl(rhs);
3✔
2546
    }
2547
}
2548

2549
impl ShlAssign<&u16> for U8Vec4 {
2550
    #[inline]
2551
    fn shl_assign(&mut self, rhs: &u16) {
3✔
2552
        self.shl_assign(*rhs);
3✔
2553
    }
2554
}
2555

2556
impl Shr<u16> for U8Vec4 {
2557
    type Output = Self;
2558
    #[inline]
2559
    fn shr(self, rhs: u16) -> Self::Output {
3✔
2560
        Self {
2561
            x: self.x.shr(rhs),
3✔
2562
            y: self.y.shr(rhs),
3✔
2563
            z: self.z.shr(rhs),
3✔
2564
            w: self.w.shr(rhs),
3✔
2565
        }
2566
    }
2567
}
2568

2569
impl Shr<&u16> for U8Vec4 {
2570
    type Output = Self;
2571
    #[inline]
2572
    fn shr(self, rhs: &u16) -> Self {
3✔
2573
        self.shr(*rhs)
3✔
2574
    }
2575
}
2576

2577
impl Shr<&u16> for &U8Vec4 {
2578
    type Output = U8Vec4;
2579
    #[inline]
2580
    fn shr(self, rhs: &u16) -> U8Vec4 {
3✔
2581
        (*self).shr(*rhs)
3✔
2582
    }
2583
}
2584

2585
impl Shr<u16> for &U8Vec4 {
2586
    type Output = U8Vec4;
2587
    #[inline]
2588
    fn shr(self, rhs: u16) -> U8Vec4 {
3✔
2589
        (*self).shr(rhs)
3✔
2590
    }
2591
}
2592

2593
impl ShrAssign<u16> for U8Vec4 {
2594
    #[inline]
2595
    fn shr_assign(&mut self, rhs: u16) {
3✔
2596
        *self = self.shr(rhs);
3✔
2597
    }
2598
}
2599

2600
impl ShrAssign<&u16> for U8Vec4 {
2601
    #[inline]
2602
    fn shr_assign(&mut self, rhs: &u16) {
3✔
2603
        self.shr_assign(*rhs);
3✔
2604
    }
2605
}
2606

2607
impl Shl<u32> for U8Vec4 {
2608
    type Output = Self;
2609
    #[inline]
2610
    fn shl(self, rhs: u32) -> Self::Output {
3✔
2611
        Self {
2612
            x: self.x.shl(rhs),
3✔
2613
            y: self.y.shl(rhs),
3✔
2614
            z: self.z.shl(rhs),
3✔
2615
            w: self.w.shl(rhs),
3✔
2616
        }
2617
    }
2618
}
2619

2620
impl Shl<&u32> for U8Vec4 {
2621
    type Output = Self;
2622
    #[inline]
2623
    fn shl(self, rhs: &u32) -> Self {
3✔
2624
        self.shl(*rhs)
3✔
2625
    }
2626
}
2627

2628
impl Shl<&u32> for &U8Vec4 {
2629
    type Output = U8Vec4;
2630
    #[inline]
2631
    fn shl(self, rhs: &u32) -> U8Vec4 {
3✔
2632
        (*self).shl(*rhs)
3✔
2633
    }
2634
}
2635

2636
impl Shl<u32> for &U8Vec4 {
2637
    type Output = U8Vec4;
2638
    #[inline]
2639
    fn shl(self, rhs: u32) -> U8Vec4 {
3✔
2640
        (*self).shl(rhs)
3✔
2641
    }
2642
}
2643

2644
impl ShlAssign<u32> for U8Vec4 {
2645
    #[inline]
2646
    fn shl_assign(&mut self, rhs: u32) {
3✔
2647
        *self = self.shl(rhs);
3✔
2648
    }
2649
}
2650

2651
impl ShlAssign<&u32> for U8Vec4 {
2652
    #[inline]
2653
    fn shl_assign(&mut self, rhs: &u32) {
3✔
2654
        self.shl_assign(*rhs);
3✔
2655
    }
2656
}
2657

2658
impl Shr<u32> for U8Vec4 {
2659
    type Output = Self;
2660
    #[inline]
2661
    fn shr(self, rhs: u32) -> Self::Output {
3✔
2662
        Self {
2663
            x: self.x.shr(rhs),
3✔
2664
            y: self.y.shr(rhs),
3✔
2665
            z: self.z.shr(rhs),
3✔
2666
            w: self.w.shr(rhs),
3✔
2667
        }
2668
    }
2669
}
2670

2671
impl Shr<&u32> for U8Vec4 {
2672
    type Output = Self;
2673
    #[inline]
2674
    fn shr(self, rhs: &u32) -> Self {
3✔
2675
        self.shr(*rhs)
3✔
2676
    }
2677
}
2678

2679
impl Shr<&u32> for &U8Vec4 {
2680
    type Output = U8Vec4;
2681
    #[inline]
2682
    fn shr(self, rhs: &u32) -> U8Vec4 {
3✔
2683
        (*self).shr(*rhs)
3✔
2684
    }
2685
}
2686

2687
impl Shr<u32> for &U8Vec4 {
2688
    type Output = U8Vec4;
2689
    #[inline]
2690
    fn shr(self, rhs: u32) -> U8Vec4 {
3✔
2691
        (*self).shr(rhs)
3✔
2692
    }
2693
}
2694

2695
impl ShrAssign<u32> for U8Vec4 {
2696
    #[inline]
2697
    fn shr_assign(&mut self, rhs: u32) {
3✔
2698
        *self = self.shr(rhs);
3✔
2699
    }
2700
}
2701

2702
impl ShrAssign<&u32> for U8Vec4 {
2703
    #[inline]
2704
    fn shr_assign(&mut self, rhs: &u32) {
3✔
2705
        self.shr_assign(*rhs);
3✔
2706
    }
2707
}
2708

2709
impl Shl<u64> for U8Vec4 {
2710
    type Output = Self;
2711
    #[inline]
2712
    fn shl(self, rhs: u64) -> Self::Output {
3✔
2713
        Self {
2714
            x: self.x.shl(rhs),
3✔
2715
            y: self.y.shl(rhs),
3✔
2716
            z: self.z.shl(rhs),
3✔
2717
            w: self.w.shl(rhs),
3✔
2718
        }
2719
    }
2720
}
2721

2722
impl Shl<&u64> for U8Vec4 {
2723
    type Output = Self;
2724
    #[inline]
2725
    fn shl(self, rhs: &u64) -> Self {
3✔
2726
        self.shl(*rhs)
3✔
2727
    }
2728
}
2729

2730
impl Shl<&u64> for &U8Vec4 {
2731
    type Output = U8Vec4;
2732
    #[inline]
2733
    fn shl(self, rhs: &u64) -> U8Vec4 {
3✔
2734
        (*self).shl(*rhs)
3✔
2735
    }
2736
}
2737

2738
impl Shl<u64> for &U8Vec4 {
2739
    type Output = U8Vec4;
2740
    #[inline]
2741
    fn shl(self, rhs: u64) -> U8Vec4 {
3✔
2742
        (*self).shl(rhs)
3✔
2743
    }
2744
}
2745

2746
impl ShlAssign<u64> for U8Vec4 {
2747
    #[inline]
2748
    fn shl_assign(&mut self, rhs: u64) {
3✔
2749
        *self = self.shl(rhs);
3✔
2750
    }
2751
}
2752

2753
impl ShlAssign<&u64> for U8Vec4 {
2754
    #[inline]
2755
    fn shl_assign(&mut self, rhs: &u64) {
3✔
2756
        self.shl_assign(*rhs);
3✔
2757
    }
2758
}
2759

2760
impl Shr<u64> for U8Vec4 {
2761
    type Output = Self;
2762
    #[inline]
2763
    fn shr(self, rhs: u64) -> Self::Output {
3✔
2764
        Self {
2765
            x: self.x.shr(rhs),
3✔
2766
            y: self.y.shr(rhs),
3✔
2767
            z: self.z.shr(rhs),
3✔
2768
            w: self.w.shr(rhs),
3✔
2769
        }
2770
    }
2771
}
2772

2773
impl Shr<&u64> for U8Vec4 {
2774
    type Output = Self;
2775
    #[inline]
2776
    fn shr(self, rhs: &u64) -> Self {
3✔
2777
        self.shr(*rhs)
3✔
2778
    }
2779
}
2780

2781
impl Shr<&u64> for &U8Vec4 {
2782
    type Output = U8Vec4;
2783
    #[inline]
2784
    fn shr(self, rhs: &u64) -> U8Vec4 {
3✔
2785
        (*self).shr(*rhs)
3✔
2786
    }
2787
}
2788

2789
impl Shr<u64> for &U8Vec4 {
2790
    type Output = U8Vec4;
2791
    #[inline]
2792
    fn shr(self, rhs: u64) -> U8Vec4 {
3✔
2793
        (*self).shr(rhs)
3✔
2794
    }
2795
}
2796

2797
impl ShrAssign<u64> for U8Vec4 {
2798
    #[inline]
2799
    fn shr_assign(&mut self, rhs: u64) {
3✔
2800
        *self = self.shr(rhs);
3✔
2801
    }
2802
}
2803

2804
impl ShrAssign<&u64> for U8Vec4 {
2805
    #[inline]
2806
    fn shr_assign(&mut self, rhs: &u64) {
3✔
2807
        self.shr_assign(*rhs);
3✔
2808
    }
2809
}
2810

2811
#[cfg(feature = "i32")]
2812

2813
impl Shl<IVec4> for U8Vec4 {
2814
    type Output = Self;
2815
    #[inline]
2816
    fn shl(self, rhs: IVec4) -> Self {
3✔
2817
        Self {
2818
            x: self.x.shl(rhs.x),
3✔
2819
            y: self.y.shl(rhs.y),
3✔
2820
            z: self.z.shl(rhs.z),
3✔
2821
            w: self.w.shl(rhs.w),
3✔
2822
        }
2823
    }
2824
}
2825

2826
#[cfg(feature = "i32")]
2827

2828
impl Shl<&IVec4> for U8Vec4 {
2829
    type Output = Self;
2830
    #[inline]
2831
    fn shl(self, rhs: &IVec4) -> Self {
3✔
2832
        self.shl(*rhs)
3✔
2833
    }
2834
}
2835

2836
#[cfg(feature = "i32")]
2837

2838
impl Shl<&IVec4> for &U8Vec4 {
2839
    type Output = U8Vec4;
2840
    #[inline]
2841
    fn shl(self, rhs: &IVec4) -> U8Vec4 {
3✔
2842
        (*self).shl(*rhs)
3✔
2843
    }
2844
}
2845

2846
#[cfg(feature = "i32")]
2847

2848
impl Shl<IVec4> for &U8Vec4 {
2849
    type Output = U8Vec4;
2850
    #[inline]
2851
    fn shl(self, rhs: IVec4) -> U8Vec4 {
3✔
2852
        (*self).shl(rhs)
3✔
2853
    }
2854
}
2855

2856
#[cfg(feature = "i32")]
2857

2858
impl Shr<IVec4> for U8Vec4 {
2859
    type Output = Self;
2860
    #[inline]
2861
    fn shr(self, rhs: IVec4) -> Self {
3✔
2862
        Self {
2863
            x: self.x.shr(rhs.x),
3✔
2864
            y: self.y.shr(rhs.y),
3✔
2865
            z: self.z.shr(rhs.z),
3✔
2866
            w: self.w.shr(rhs.w),
3✔
2867
        }
2868
    }
2869
}
2870

2871
#[cfg(feature = "i32")]
2872

2873
impl Shr<&IVec4> for U8Vec4 {
2874
    type Output = Self;
2875
    #[inline]
2876
    fn shr(self, rhs: &IVec4) -> Self {
3✔
2877
        self.shr(*rhs)
3✔
2878
    }
2879
}
2880

2881
#[cfg(feature = "i32")]
2882

2883
impl Shr<&IVec4> for &U8Vec4 {
2884
    type Output = U8Vec4;
2885
    #[inline]
2886
    fn shr(self, rhs: &IVec4) -> U8Vec4 {
3✔
2887
        (*self).shr(*rhs)
3✔
2888
    }
2889
}
2890

2891
#[cfg(feature = "i32")]
2892

2893
impl Shr<IVec4> for &U8Vec4 {
2894
    type Output = U8Vec4;
2895
    #[inline]
2896
    fn shr(self, rhs: IVec4) -> U8Vec4 {
3✔
2897
        (*self).shr(rhs)
3✔
2898
    }
2899
}
2900

2901
#[cfg(feature = "u32")]
2902

2903
impl Shl<UVec4> for U8Vec4 {
2904
    type Output = Self;
2905
    #[inline]
2906
    fn shl(self, rhs: UVec4) -> Self {
3✔
2907
        Self {
2908
            x: self.x.shl(rhs.x),
3✔
2909
            y: self.y.shl(rhs.y),
3✔
2910
            z: self.z.shl(rhs.z),
3✔
2911
            w: self.w.shl(rhs.w),
3✔
2912
        }
2913
    }
2914
}
2915

2916
#[cfg(feature = "u32")]
2917

2918
impl Shl<&UVec4> for U8Vec4 {
2919
    type Output = Self;
2920
    #[inline]
2921
    fn shl(self, rhs: &UVec4) -> Self {
3✔
2922
        self.shl(*rhs)
3✔
2923
    }
2924
}
2925

2926
#[cfg(feature = "u32")]
2927

2928
impl Shl<&UVec4> for &U8Vec4 {
2929
    type Output = U8Vec4;
2930
    #[inline]
2931
    fn shl(self, rhs: &UVec4) -> U8Vec4 {
3✔
2932
        (*self).shl(*rhs)
3✔
2933
    }
2934
}
2935

2936
#[cfg(feature = "u32")]
2937

2938
impl Shl<UVec4> for &U8Vec4 {
2939
    type Output = U8Vec4;
2940
    #[inline]
2941
    fn shl(self, rhs: UVec4) -> U8Vec4 {
3✔
2942
        (*self).shl(rhs)
3✔
2943
    }
2944
}
2945

2946
#[cfg(feature = "u32")]
2947

2948
impl Shr<UVec4> for U8Vec4 {
2949
    type Output = Self;
2950
    #[inline]
2951
    fn shr(self, rhs: UVec4) -> Self {
3✔
2952
        Self {
2953
            x: self.x.shr(rhs.x),
3✔
2954
            y: self.y.shr(rhs.y),
3✔
2955
            z: self.z.shr(rhs.z),
3✔
2956
            w: self.w.shr(rhs.w),
3✔
2957
        }
2958
    }
2959
}
2960

2961
#[cfg(feature = "u32")]
2962

2963
impl Shr<&UVec4> for U8Vec4 {
2964
    type Output = Self;
2965
    #[inline]
2966
    fn shr(self, rhs: &UVec4) -> Self {
3✔
2967
        self.shr(*rhs)
3✔
2968
    }
2969
}
2970

2971
#[cfg(feature = "u32")]
2972

2973
impl Shr<&UVec4> for &U8Vec4 {
2974
    type Output = U8Vec4;
2975
    #[inline]
2976
    fn shr(self, rhs: &UVec4) -> U8Vec4 {
3✔
2977
        (*self).shr(*rhs)
3✔
2978
    }
2979
}
2980

2981
#[cfg(feature = "u32")]
2982

2983
impl Shr<UVec4> for &U8Vec4 {
2984
    type Output = U8Vec4;
2985
    #[inline]
2986
    fn shr(self, rhs: UVec4) -> U8Vec4 {
3✔
2987
        (*self).shr(rhs)
3✔
2988
    }
2989
}
2990

2991
impl Index<usize> for U8Vec4 {
2992
    type Output = u8;
2993
    #[inline]
2994
    fn index(&self, index: usize) -> &Self::Output {
3✔
2995
        match index {
6✔
2996
            0 => &self.x,
3✔
2997
            1 => &self.y,
3✔
2998
            2 => &self.z,
3✔
2999
            3 => &self.w,
3✔
3000
            _ => panic!("index out of bounds"),
×
3001
        }
3002
    }
3003
}
3004

3005
impl IndexMut<usize> for U8Vec4 {
3006
    #[inline]
3007
    fn index_mut(&mut self, index: usize) -> &mut Self::Output {
3✔
3008
        match index {
6✔
3009
            0 => &mut self.x,
3✔
3010
            1 => &mut self.y,
3✔
3011
            2 => &mut self.z,
3✔
3012
            3 => &mut self.w,
3✔
3013
            _ => panic!("index out of bounds"),
×
3014
        }
3015
    }
3016
}
3017

3018
impl fmt::Display for U8Vec4 {
3019
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3✔
3020
        write!(f, "[{}, {}, {}, {}]", self.x, self.y, self.z, self.w)
3✔
3021
    }
3022
}
3023

3024
impl fmt::Debug for U8Vec4 {
3025
    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
3✔
3026
        fmt.debug_tuple(stringify!(U8Vec4))
3✔
3027
            .field(&self.x)
3✔
3028
            .field(&self.y)
3✔
3029
            .field(&self.z)
3✔
3030
            .field(&self.w)
3✔
3031
            .finish()
3032
    }
3033
}
3034

3035
impl From<[u8; 4]> for U8Vec4 {
3036
    #[inline]
3037
    fn from(a: [u8; 4]) -> Self {
6✔
3038
        Self::new(a[0], a[1], a[2], a[3])
12✔
3039
    }
3040
}
3041

3042
impl From<U8Vec4> for [u8; 4] {
3043
    #[inline]
3044
    fn from(v: U8Vec4) -> Self {
3✔
3045
        [v.x, v.y, v.z, v.w]
3✔
3046
    }
3047
}
3048

3049
impl From<(u8, u8, u8, u8)> for U8Vec4 {
3050
    #[inline]
3051
    fn from(t: (u8, u8, u8, u8)) -> Self {
3✔
3052
        Self::new(t.0, t.1, t.2, t.3)
6✔
3053
    }
3054
}
3055

3056
impl From<U8Vec4> for (u8, u8, u8, u8) {
3057
    #[inline]
3058
    fn from(v: U8Vec4) -> Self {
9✔
3059
        (v.x, v.y, v.z, v.w)
9✔
3060
    }
3061
}
3062

3063
impl From<(U8Vec3, u8)> for U8Vec4 {
3064
    #[inline]
3065
    fn from((v, w): (U8Vec3, u8)) -> Self {
6✔
3066
        Self::new(v.x, v.y, v.z, w)
6✔
3067
    }
3068
}
3069

3070
impl From<(u8, U8Vec3)> for U8Vec4 {
3071
    #[inline]
3072
    fn from((x, v): (u8, U8Vec3)) -> Self {
6✔
3073
        Self::new(x, v.x, v.y, v.z)
6✔
3074
    }
3075
}
3076

3077
impl From<(U8Vec2, u8, u8)> for U8Vec4 {
3078
    #[inline]
3079
    fn from((v, z, w): (U8Vec2, u8, u8)) -> Self {
6✔
3080
        Self::new(v.x, v.y, z, w)
3✔
3081
    }
3082
}
3083

3084
impl From<(U8Vec2, U8Vec2)> for U8Vec4 {
3085
    #[inline]
3086
    fn from((v, u): (U8Vec2, U8Vec2)) -> Self {
6✔
3087
        Self::new(v.x, v.y, u.x, u.y)
3✔
3088
    }
3089
}
3090

3091
#[cfg(feature = "i8")]
3092

3093
impl TryFrom<I8Vec4> for U8Vec4 {
3094
    type Error = core::num::TryFromIntError;
3095

3096
    #[inline]
3097
    fn try_from(v: I8Vec4) -> Result<Self, Self::Error> {
3✔
3098
        Ok(Self::new(
3✔
3099
            u8::try_from(v.x)?,
3✔
3100
            u8::try_from(v.y)?,
3✔
3101
            u8::try_from(v.z)?,
3✔
3102
            u8::try_from(v.w)?,
3✔
3103
        ))
3104
    }
3105
}
3106

3107
#[cfg(feature = "i16")]
3108

3109
impl TryFrom<I16Vec4> for U8Vec4 {
3110
    type Error = core::num::TryFromIntError;
3111

3112
    #[inline]
3113
    fn try_from(v: I16Vec4) -> Result<Self, Self::Error> {
3✔
3114
        Ok(Self::new(
3✔
3115
            u8::try_from(v.x)?,
3✔
3116
            u8::try_from(v.y)?,
3✔
3117
            u8::try_from(v.z)?,
3✔
3118
            u8::try_from(v.w)?,
3✔
3119
        ))
3120
    }
3121
}
3122

3123
#[cfg(feature = "u16")]
3124

3125
impl TryFrom<U16Vec4> for U8Vec4 {
3126
    type Error = core::num::TryFromIntError;
3127

3128
    #[inline]
3129
    fn try_from(v: U16Vec4) -> Result<Self, Self::Error> {
3✔
3130
        Ok(Self::new(
3✔
3131
            u8::try_from(v.x)?,
3✔
3132
            u8::try_from(v.y)?,
3✔
3133
            u8::try_from(v.z)?,
3✔
3134
            u8::try_from(v.w)?,
3✔
3135
        ))
3136
    }
3137
}
3138

3139
#[cfg(feature = "i32")]
3140

3141
impl TryFrom<IVec4> for U8Vec4 {
3142
    type Error = core::num::TryFromIntError;
3143

3144
    #[inline]
3145
    fn try_from(v: IVec4) -> Result<Self, Self::Error> {
3✔
3146
        Ok(Self::new(
3✔
3147
            u8::try_from(v.x)?,
3✔
3148
            u8::try_from(v.y)?,
3✔
3149
            u8::try_from(v.z)?,
3✔
3150
            u8::try_from(v.w)?,
3✔
3151
        ))
3152
    }
3153
}
3154

3155
#[cfg(feature = "u32")]
3156

3157
impl TryFrom<UVec4> for U8Vec4 {
3158
    type Error = core::num::TryFromIntError;
3159

3160
    #[inline]
3161
    fn try_from(v: UVec4) -> Result<Self, Self::Error> {
3✔
3162
        Ok(Self::new(
3✔
3163
            u8::try_from(v.x)?,
3✔
3164
            u8::try_from(v.y)?,
3✔
3165
            u8::try_from(v.z)?,
3✔
3166
            u8::try_from(v.w)?,
3✔
3167
        ))
3168
    }
3169
}
3170

3171
#[cfg(feature = "i64")]
3172

3173
impl TryFrom<I64Vec4> for U8Vec4 {
3174
    type Error = core::num::TryFromIntError;
3175

3176
    #[inline]
3177
    fn try_from(v: I64Vec4) -> Result<Self, Self::Error> {
3✔
3178
        Ok(Self::new(
3✔
3179
            u8::try_from(v.x)?,
3✔
3180
            u8::try_from(v.y)?,
3✔
3181
            u8::try_from(v.z)?,
3✔
3182
            u8::try_from(v.w)?,
3✔
3183
        ))
3184
    }
3185
}
3186

3187
#[cfg(feature = "u64")]
3188

3189
impl TryFrom<U64Vec4> for U8Vec4 {
3190
    type Error = core::num::TryFromIntError;
3191

3192
    #[inline]
3193
    fn try_from(v: U64Vec4) -> Result<Self, Self::Error> {
3✔
3194
        Ok(Self::new(
3✔
3195
            u8::try_from(v.x)?,
3✔
3196
            u8::try_from(v.y)?,
3✔
3197
            u8::try_from(v.z)?,
3✔
3198
            u8::try_from(v.w)?,
3✔
3199
        ))
3200
    }
3201
}
3202

3203
#[cfg(feature = "isize")]
3204

3205
impl TryFrom<ISizeVec4> for U8Vec4 {
3206
    type Error = core::num::TryFromIntError;
3207

3208
    #[inline]
3209
    fn try_from(v: ISizeVec4) -> Result<Self, Self::Error> {
3✔
3210
        Ok(Self::new(
3✔
3211
            u8::try_from(v.x)?,
3✔
3212
            u8::try_from(v.y)?,
3✔
3213
            u8::try_from(v.z)?,
3✔
3214
            u8::try_from(v.w)?,
3✔
3215
        ))
3216
    }
3217
}
3218

3219
#[cfg(feature = "usize")]
3220

3221
impl TryFrom<USizeVec4> for U8Vec4 {
3222
    type Error = core::num::TryFromIntError;
3223

3224
    #[inline]
3225
    fn try_from(v: USizeVec4) -> Result<Self, Self::Error> {
3✔
3226
        Ok(Self::new(
3✔
3227
            u8::try_from(v.x)?,
3✔
3228
            u8::try_from(v.y)?,
3✔
3229
            u8::try_from(v.z)?,
3✔
3230
            u8::try_from(v.w)?,
3✔
3231
        ))
3232
    }
3233
}
3234

3235
impl From<BVec4> for U8Vec4 {
3236
    #[inline]
3237
    fn from(v: BVec4) -> Self {
3✔
3238
        Self::new(u8::from(v.x), u8::from(v.y), u8::from(v.z), u8::from(v.w))
6✔
3239
    }
3240
}
3241

3242
#[cfg(not(feature = "scalar-math"))]
3243
impl From<BVec4A> for U8Vec4 {
3244
    #[inline]
3245
    fn from(v: BVec4A) -> Self {
2✔
3246
        let bool_array: [bool; 4] = v.into();
2✔
3247
        Self::new(
3248
            u8::from(bool_array[0]),
2✔
3249
            u8::from(bool_array[1]),
2✔
3250
            u8::from(bool_array[2]),
2✔
3251
            u8::from(bool_array[3]),
2✔
3252
        )
3253
    }
3254
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc