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