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