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