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