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