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