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