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