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