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