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