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