• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Generated from vec.rs.tera template. Edit the template, not the generated file.
2 
3 use crate::{BVec2, I16Vec2, I64Vec2, I8Vec3, IVec2, U16Vec2, U64Vec2, U8Vec2, UVec2};
4 
5 use core::fmt;
6 use core::iter::{Product, Sum};
7 use core::{f32, ops::*};
8 
9 /// Creates a 2-dimensional vector.
10 #[inline(always)]
11 #[must_use]
i8vec2(x: i8, y: i8) -> I8Vec212 pub const fn i8vec2(x: i8, y: i8) -> I8Vec2 {
13     I8Vec2::new(x, y)
14 }
15 
16 /// A 2-dimensional vector.
17 #[cfg_attr(not(target_arch = "spirv"), derive(Hash))]
18 #[derive(Clone, Copy, PartialEq, Eq)]
19 #[cfg_attr(feature = "cuda", repr(align(2)))]
20 #[cfg_attr(not(target_arch = "spirv"), repr(C))]
21 #[cfg_attr(target_arch = "spirv", repr(simd))]
22 pub struct I8Vec2 {
23     pub x: i8,
24     pub y: i8,
25 }
26 
27 impl I8Vec2 {
28     /// All zeroes.
29     pub const ZERO: Self = Self::splat(0);
30 
31     /// All ones.
32     pub const ONE: Self = Self::splat(1);
33 
34     /// All negative ones.
35     pub const NEG_ONE: Self = Self::splat(-1);
36 
37     /// All `i8::MIN`.
38     pub const MIN: Self = Self::splat(i8::MIN);
39 
40     /// All `i8::MAX`.
41     pub const MAX: Self = Self::splat(i8::MAX);
42 
43     /// A unit vector pointing along the positive X axis.
44     pub const X: Self = Self::new(1, 0);
45 
46     /// A unit vector pointing along the positive Y axis.
47     pub const Y: Self = Self::new(0, 1);
48 
49     /// A unit vector pointing along the negative X axis.
50     pub const NEG_X: Self = Self::new(-1, 0);
51 
52     /// A unit vector pointing along the negative Y axis.
53     pub const NEG_Y: Self = Self::new(0, -1);
54 
55     /// The unit axes.
56     pub const AXES: [Self; 2] = [Self::X, Self::Y];
57 
58     /// Creates a new vector.
59     #[inline(always)]
60     #[must_use]
new(x: i8, y: i8) -> Self61     pub const fn new(x: i8, y: i8) -> Self {
62         Self { x, y }
63     }
64 
65     /// Creates a vector with all elements set to `v`.
66     #[inline]
67     #[must_use]
splat(v: i8) -> Self68     pub const fn splat(v: i8) -> Self {
69         Self { x: v, y: v }
70     }
71 
72     /// Returns a vector containing each element of `self` modified by a mapping function `f`.
73     #[inline]
74     #[must_use]
map<F>(self, f: F) -> Self where F: Fn(i8) -> i8,75     pub fn map<F>(self, f: F) -> Self
76     where
77         F: Fn(i8) -> i8,
78     {
79         Self::new(f(self.x), f(self.y))
80     }
81 
82     /// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use
83     /// for each element of `self`.
84     ///
85     /// A true element in the mask uses the corresponding element from `if_true`, and false
86     /// uses the element from `if_false`.
87     #[inline]
88     #[must_use]
select(mask: BVec2, if_true: Self, if_false: Self) -> Self89     pub fn select(mask: BVec2, if_true: Self, if_false: Self) -> Self {
90         Self {
91             x: if mask.test(0) { if_true.x } else { if_false.x },
92             y: if mask.test(1) { if_true.y } else { if_false.y },
93         }
94     }
95 
96     /// Creates a new vector from an array.
97     #[inline]
98     #[must_use]
from_array(a: [i8; 2]) -> Self99     pub const fn from_array(a: [i8; 2]) -> Self {
100         Self::new(a[0], a[1])
101     }
102 
103     /// `[x, y]`
104     #[inline]
105     #[must_use]
to_array(&self) -> [i8; 2]106     pub const fn to_array(&self) -> [i8; 2] {
107         [self.x, self.y]
108     }
109 
110     /// Creates a vector from the first 2 values in `slice`.
111     ///
112     /// # Panics
113     ///
114     /// Panics if `slice` is less than 2 elements long.
115     #[inline]
116     #[must_use]
from_slice(slice: &[i8]) -> Self117     pub const fn from_slice(slice: &[i8]) -> Self {
118         assert!(slice.len() >= 2);
119         Self::new(slice[0], slice[1])
120     }
121 
122     /// Writes the elements of `self` to the first 2 elements in `slice`.
123     ///
124     /// # Panics
125     ///
126     /// Panics if `slice` is less than 2 elements long.
127     #[inline]
write_to_slice(self, slice: &mut [i8])128     pub fn write_to_slice(self, slice: &mut [i8]) {
129         slice[..2].copy_from_slice(&self.to_array());
130     }
131 
132     /// Creates a 3D vector from `self` and the given `z` value.
133     #[inline]
134     #[must_use]
extend(self, z: i8) -> I8Vec3135     pub const fn extend(self, z: i8) -> I8Vec3 {
136         I8Vec3::new(self.x, self.y, z)
137     }
138 
139     /// Creates a 2D vector from `self` with the given value of `x`.
140     #[inline]
141     #[must_use]
with_x(mut self, x: i8) -> Self142     pub fn with_x(mut self, x: i8) -> Self {
143         self.x = x;
144         self
145     }
146 
147     /// Creates a 2D vector from `self` with the given value of `y`.
148     #[inline]
149     #[must_use]
with_y(mut self, y: i8) -> Self150     pub fn with_y(mut self, y: i8) -> Self {
151         self.y = y;
152         self
153     }
154 
155     /// Computes the dot product of `self` and `rhs`.
156     #[inline]
157     #[must_use]
dot(self, rhs: Self) -> i8158     pub fn dot(self, rhs: Self) -> i8 {
159         (self.x * rhs.x) + (self.y * rhs.y)
160     }
161 
162     /// Returns a vector where every component is the dot product of `self` and `rhs`.
163     #[inline]
164     #[must_use]
dot_into_vec(self, rhs: Self) -> Self165     pub fn dot_into_vec(self, rhs: Self) -> Self {
166         Self::splat(self.dot(rhs))
167     }
168 
169     /// Returns a vector containing the minimum values for each element of `self` and `rhs`.
170     ///
171     /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`.
172     #[inline]
173     #[must_use]
min(self, rhs: Self) -> Self174     pub fn min(self, rhs: Self) -> Self {
175         Self {
176             x: self.x.min(rhs.x),
177             y: self.y.min(rhs.y),
178         }
179     }
180 
181     /// Returns a vector containing the maximum values for each element of `self` and `rhs`.
182     ///
183     /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`.
184     #[inline]
185     #[must_use]
max(self, rhs: Self) -> Self186     pub fn max(self, rhs: Self) -> Self {
187         Self {
188             x: self.x.max(rhs.x),
189             y: self.y.max(rhs.y),
190         }
191     }
192 
193     /// Component-wise clamping of values, similar to [`i8::clamp`].
194     ///
195     /// Each element in `min` must be less-or-equal to the corresponding element in `max`.
196     ///
197     /// # Panics
198     ///
199     /// Will panic if `min` is greater than `max` when `glam_assert` is enabled.
200     #[inline]
201     #[must_use]
clamp(self, min: Self, max: Self) -> Self202     pub fn clamp(self, min: Self, max: Self) -> Self {
203         glam_assert!(min.cmple(max).all(), "clamp: expected min <= max");
204         self.max(min).min(max)
205     }
206 
207     /// Returns the horizontal minimum of `self`.
208     ///
209     /// In other words this computes `min(x, y, ..)`.
210     #[inline]
211     #[must_use]
min_element(self) -> i8212     pub fn min_element(self) -> i8 {
213         self.x.min(self.y)
214     }
215 
216     /// Returns the horizontal maximum of `self`.
217     ///
218     /// In other words this computes `max(x, y, ..)`.
219     #[inline]
220     #[must_use]
max_element(self) -> i8221     pub fn max_element(self) -> i8 {
222         self.x.max(self.y)
223     }
224 
225     /// Returns the sum of all elements of `self`.
226     ///
227     /// In other words, this computes `self.x + self.y + ..`.
228     #[inline]
229     #[must_use]
element_sum(self) -> i8230     pub fn element_sum(self) -> i8 {
231         self.x + self.y
232     }
233 
234     /// Returns the product of all elements of `self`.
235     ///
236     /// In other words, this computes `self.x * self.y * ..`.
237     #[inline]
238     #[must_use]
element_product(self) -> i8239     pub fn element_product(self) -> i8 {
240         self.x * self.y
241     }
242 
243     /// Returns a vector mask containing the result of a `==` comparison for each element of
244     /// `self` and `rhs`.
245     ///
246     /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all
247     /// elements.
248     #[inline]
249     #[must_use]
cmpeq(self, rhs: Self) -> BVec2250     pub fn cmpeq(self, rhs: Self) -> BVec2 {
251         BVec2::new(self.x.eq(&rhs.x), self.y.eq(&rhs.y))
252     }
253 
254     /// Returns a vector mask containing the result of a `!=` comparison for each element of
255     /// `self` and `rhs`.
256     ///
257     /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all
258     /// elements.
259     #[inline]
260     #[must_use]
cmpne(self, rhs: Self) -> BVec2261     pub fn cmpne(self, rhs: Self) -> BVec2 {
262         BVec2::new(self.x.ne(&rhs.x), self.y.ne(&rhs.y))
263     }
264 
265     /// Returns a vector mask containing the result of a `>=` comparison for each element of
266     /// `self` and `rhs`.
267     ///
268     /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all
269     /// elements.
270     #[inline]
271     #[must_use]
cmpge(self, rhs: Self) -> BVec2272     pub fn cmpge(self, rhs: Self) -> BVec2 {
273         BVec2::new(self.x.ge(&rhs.x), self.y.ge(&rhs.y))
274     }
275 
276     /// Returns a vector mask containing the result of a `>` comparison for each element of
277     /// `self` and `rhs`.
278     ///
279     /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all
280     /// elements.
281     #[inline]
282     #[must_use]
cmpgt(self, rhs: Self) -> BVec2283     pub fn cmpgt(self, rhs: Self) -> BVec2 {
284         BVec2::new(self.x.gt(&rhs.x), self.y.gt(&rhs.y))
285     }
286 
287     /// Returns a vector mask containing the result of a `<=` comparison for each element of
288     /// `self` and `rhs`.
289     ///
290     /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all
291     /// elements.
292     #[inline]
293     #[must_use]
cmple(self, rhs: Self) -> BVec2294     pub fn cmple(self, rhs: Self) -> BVec2 {
295         BVec2::new(self.x.le(&rhs.x), self.y.le(&rhs.y))
296     }
297 
298     /// Returns a vector mask containing the result of a `<` comparison for each element of
299     /// `self` and `rhs`.
300     ///
301     /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all
302     /// elements.
303     #[inline]
304     #[must_use]
cmplt(self, rhs: Self) -> BVec2305     pub fn cmplt(self, rhs: Self) -> BVec2 {
306         BVec2::new(self.x.lt(&rhs.x), self.y.lt(&rhs.y))
307     }
308 
309     /// Returns a vector containing the absolute value of each element of `self`.
310     #[inline]
311     #[must_use]
abs(self) -> Self312     pub fn abs(self) -> Self {
313         Self {
314             x: self.x.abs(),
315             y: self.y.abs(),
316         }
317     }
318 
319     /// Returns a vector with elements representing the sign of `self`.
320     ///
321     ///  - `0` if the number is zero
322     ///  - `1` if the number is positive
323     ///  - `-1` if the number is negative
324     #[inline]
325     #[must_use]
signum(self) -> Self326     pub fn signum(self) -> Self {
327         Self {
328             x: self.x.signum(),
329             y: self.y.signum(),
330         }
331     }
332 
333     /// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`.
334     ///
335     /// A negative element results in a `1` bit and a positive element in a `0` bit.  Element `x` goes
336     /// into the first lowest bit, element `y` into the second, etc.
337     #[inline]
338     #[must_use]
is_negative_bitmask(self) -> u32339     pub fn is_negative_bitmask(self) -> u32 {
340         (self.x.is_negative() as u32) | (self.y.is_negative() as u32) << 1
341     }
342 
343     /// Computes the squared length of `self`.
344     #[doc(alias = "magnitude2")]
345     #[inline]
346     #[must_use]
length_squared(self) -> i8347     pub fn length_squared(self) -> i8 {
348         self.dot(self)
349     }
350 
351     /// Compute the squared euclidean distance between two points in space.
352     #[inline]
353     #[must_use]
distance_squared(self, rhs: Self) -> i8354     pub fn distance_squared(self, rhs: Self) -> i8 {
355         (self - rhs).length_squared()
356     }
357 
358     /// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`.
359     ///
360     /// # Panics
361     /// This function will panic if any `rhs` element is 0 or the division results in overflow.
362     #[inline]
363     #[must_use]
div_euclid(self, rhs: Self) -> Self364     pub fn div_euclid(self, rhs: Self) -> Self {
365         Self::new(self.x.div_euclid(rhs.x), self.y.div_euclid(rhs.y))
366     }
367 
368     /// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`.
369     ///
370     /// # Panics
371     /// This function will panic if any `rhs` element is 0 or the division results in overflow.
372     ///
373     /// [Euclidean division]: i8::rem_euclid
374     #[inline]
375     #[must_use]
rem_euclid(self, rhs: Self) -> Self376     pub fn rem_euclid(self, rhs: Self) -> Self {
377         Self::new(self.x.rem_euclid(rhs.x), self.y.rem_euclid(rhs.y))
378     }
379 
380     /// Computes the [manhattan distance] between two points.
381     ///
382     /// # Overflow
383     /// This method may overflow if the result is greater than [`u8::MAX`].
384     ///
385     /// See also [`checked_manhattan_distance`][I8Vec2::checked_manhattan_distance].
386     ///
387     /// [manhattan distance]: https://en.wikipedia.org/wiki/Taxicab_geometry
388     #[inline]
389     #[must_use]
manhattan_distance(self, other: Self) -> u8390     pub fn manhattan_distance(self, other: Self) -> u8 {
391         self.x.abs_diff(other.x) + self.y.abs_diff(other.y)
392     }
393 
394     /// Computes the [manhattan distance] between two points.
395     ///
396     /// This will returns [`None`] if the result is greater than [`u8::MAX`].
397     ///
398     /// [manhattan distance]: https://en.wikipedia.org/wiki/Taxicab_geometry
399     #[inline]
400     #[must_use]
checked_manhattan_distance(self, other: Self) -> Option<u8>401     pub fn checked_manhattan_distance(self, other: Self) -> Option<u8> {
402         let d = self.x.abs_diff(other.x);
403         d.checked_add(self.y.abs_diff(other.y))
404     }
405 
406     /// Computes the [chebyshev distance] between two points.
407     ///
408     /// [chebyshev distance]: https://en.wikipedia.org/wiki/Chebyshev_distance
409     #[inline]
410     #[must_use]
chebyshev_distance(self, other: Self) -> u8411     pub fn chebyshev_distance(self, other: Self) -> u8 {
412         // Note: the compiler will eventually optimize out the loop
413         [self.x.abs_diff(other.x), self.y.abs_diff(other.y)]
414             .into_iter()
415             .max()
416             .unwrap()
417     }
418 
419     /// Returns a vector that is equal to `self` rotated by 90 degrees.
420     #[inline]
421     #[must_use]
perp(self) -> Self422     pub fn perp(self) -> Self {
423         Self {
424             x: -self.y,
425             y: self.x,
426         }
427     }
428 
429     /// The perpendicular dot product of `self` and `rhs`.
430     /// Also known as the wedge product, 2D cross product, and determinant.
431     #[doc(alias = "wedge")]
432     #[doc(alias = "cross")]
433     #[doc(alias = "determinant")]
434     #[inline]
435     #[must_use]
perp_dot(self, rhs: Self) -> i8436     pub fn perp_dot(self, rhs: Self) -> i8 {
437         (self.x * rhs.y) - (self.y * rhs.x)
438     }
439 
440     /// Returns `rhs` rotated by the angle of `self`. If `self` is normalized,
441     /// then this just rotation. This is what you usually want. Otherwise,
442     /// it will be like a rotation with a multiplication by `self`'s length.
443     #[inline]
444     #[must_use]
rotate(self, rhs: Self) -> Self445     pub fn rotate(self, rhs: Self) -> Self {
446         Self {
447             x: self.x * rhs.x - self.y * rhs.y,
448             y: self.y * rhs.x + self.x * rhs.y,
449         }
450     }
451 
452     /// Casts all elements of `self` to `f32`.
453     #[inline]
454     #[must_use]
as_vec2(&self) -> crate::Vec2455     pub fn as_vec2(&self) -> crate::Vec2 {
456         crate::Vec2::new(self.x as f32, self.y as f32)
457     }
458 
459     /// Casts all elements of `self` to `f64`.
460     #[inline]
461     #[must_use]
as_dvec2(&self) -> crate::DVec2462     pub fn as_dvec2(&self) -> crate::DVec2 {
463         crate::DVec2::new(self.x as f64, self.y as f64)
464     }
465 
466     /// Casts all elements of `self` to `u8`.
467     #[inline]
468     #[must_use]
as_u8vec2(&self) -> crate::U8Vec2469     pub fn as_u8vec2(&self) -> crate::U8Vec2 {
470         crate::U8Vec2::new(self.x as u8, self.y as u8)
471     }
472 
473     /// Casts all elements of `self` to `i16`.
474     #[inline]
475     #[must_use]
as_i16vec2(&self) -> crate::I16Vec2476     pub fn as_i16vec2(&self) -> crate::I16Vec2 {
477         crate::I16Vec2::new(self.x as i16, self.y as i16)
478     }
479 
480     /// Casts all elements of `self` to `u16`.
481     #[inline]
482     #[must_use]
as_u16vec2(&self) -> crate::U16Vec2483     pub fn as_u16vec2(&self) -> crate::U16Vec2 {
484         crate::U16Vec2::new(self.x as u16, self.y as u16)
485     }
486 
487     /// Casts all elements of `self` to `i32`.
488     #[inline]
489     #[must_use]
as_ivec2(&self) -> crate::IVec2490     pub fn as_ivec2(&self) -> crate::IVec2 {
491         crate::IVec2::new(self.x as i32, self.y as i32)
492     }
493 
494     /// Casts all elements of `self` to `u32`.
495     #[inline]
496     #[must_use]
as_uvec2(&self) -> crate::UVec2497     pub fn as_uvec2(&self) -> crate::UVec2 {
498         crate::UVec2::new(self.x as u32, self.y as u32)
499     }
500 
501     /// Casts all elements of `self` to `i64`.
502     #[inline]
503     #[must_use]
as_i64vec2(&self) -> crate::I64Vec2504     pub fn as_i64vec2(&self) -> crate::I64Vec2 {
505         crate::I64Vec2::new(self.x as i64, self.y as i64)
506     }
507 
508     /// Casts all elements of `self` to `u64`.
509     #[inline]
510     #[must_use]
as_u64vec2(&self) -> crate::U64Vec2511     pub fn as_u64vec2(&self) -> crate::U64Vec2 {
512         crate::U64Vec2::new(self.x as u64, self.y as u64)
513     }
514 
515     /// Returns a vector containing the wrapping addition of `self` and `rhs`.
516     ///
517     /// In other words this computes `Some([self.x + rhs.x, self.y + rhs.y, ..])` but returns `None` on any overflow.
518     #[inline]
519     #[must_use]
checked_add(self, rhs: Self) -> Option<Self>520     pub const fn checked_add(self, rhs: Self) -> Option<Self> {
521         let x = match self.x.checked_add(rhs.x) {
522             Some(v) => v,
523             None => return None,
524         };
525         let y = match self.y.checked_add(rhs.y) {
526             Some(v) => v,
527             None => return None,
528         };
529 
530         Some(Self { x, y })
531     }
532 
533     /// Returns a vector containing the wrapping subtraction of `self` and `rhs`.
534     ///
535     /// In other words this computes `Some([self.x - rhs.x, self.y - rhs.y, ..])` but returns `None` on any overflow.
536     #[inline]
537     #[must_use]
checked_sub(self, rhs: Self) -> Option<Self>538     pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
539         let x = match self.x.checked_sub(rhs.x) {
540             Some(v) => v,
541             None => return None,
542         };
543         let y = match self.y.checked_sub(rhs.y) {
544             Some(v) => v,
545             None => return None,
546         };
547 
548         Some(Self { x, y })
549     }
550 
551     /// Returns a vector containing the wrapping multiplication of `self` and `rhs`.
552     ///
553     /// In other words this computes `Some([self.x * rhs.x, self.y * rhs.y, ..])` but returns `None` on any overflow.
554     #[inline]
555     #[must_use]
checked_mul(self, rhs: Self) -> Option<Self>556     pub const fn checked_mul(self, rhs: Self) -> Option<Self> {
557         let x = match self.x.checked_mul(rhs.x) {
558             Some(v) => v,
559             None => return None,
560         };
561         let y = match self.y.checked_mul(rhs.y) {
562             Some(v) => v,
563             None => return None,
564         };
565 
566         Some(Self { x, y })
567     }
568 
569     /// Returns a vector containing the wrapping division of `self` and `rhs`.
570     ///
571     /// In other words this computes `Some([self.x / rhs.x, self.y / rhs.y, ..])` but returns `None` on any division by zero.
572     #[inline]
573     #[must_use]
checked_div(self, rhs: Self) -> Option<Self>574     pub const fn checked_div(self, rhs: Self) -> Option<Self> {
575         let x = match self.x.checked_div(rhs.x) {
576             Some(v) => v,
577             None => return None,
578         };
579         let y = match self.y.checked_div(rhs.y) {
580             Some(v) => v,
581             None => return None,
582         };
583 
584         Some(Self { x, y })
585     }
586 
587     /// Returns a vector containing the wrapping addition of `self` and `rhs`.
588     ///
589     /// In other words this computes `[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]`.
590     #[inline]
591     #[must_use]
wrapping_add(self, rhs: Self) -> Self592     pub const fn wrapping_add(self, rhs: Self) -> Self {
593         Self {
594             x: self.x.wrapping_add(rhs.x),
595             y: self.y.wrapping_add(rhs.y),
596         }
597     }
598 
599     /// Returns a vector containing the wrapping subtraction of `self` and `rhs`.
600     ///
601     /// In other words this computes `[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]`.
602     #[inline]
603     #[must_use]
wrapping_sub(self, rhs: Self) -> Self604     pub const fn wrapping_sub(self, rhs: Self) -> Self {
605         Self {
606             x: self.x.wrapping_sub(rhs.x),
607             y: self.y.wrapping_sub(rhs.y),
608         }
609     }
610 
611     /// Returns a vector containing the wrapping multiplication of `self` and `rhs`.
612     ///
613     /// In other words this computes `[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]`.
614     #[inline]
615     #[must_use]
wrapping_mul(self, rhs: Self) -> Self616     pub const fn wrapping_mul(self, rhs: Self) -> Self {
617         Self {
618             x: self.x.wrapping_mul(rhs.x),
619             y: self.y.wrapping_mul(rhs.y),
620         }
621     }
622 
623     /// Returns a vector containing the wrapping division of `self` and `rhs`.
624     ///
625     /// In other words this computes `[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]`.
626     #[inline]
627     #[must_use]
wrapping_div(self, rhs: Self) -> Self628     pub const fn wrapping_div(self, rhs: Self) -> Self {
629         Self {
630             x: self.x.wrapping_div(rhs.x),
631             y: self.y.wrapping_div(rhs.y),
632         }
633     }
634 
635     /// Returns a vector containing the saturating addition of `self` and `rhs`.
636     ///
637     /// In other words this computes `[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]`.
638     #[inline]
639     #[must_use]
saturating_add(self, rhs: Self) -> Self640     pub const fn saturating_add(self, rhs: Self) -> Self {
641         Self {
642             x: self.x.saturating_add(rhs.x),
643             y: self.y.saturating_add(rhs.y),
644         }
645     }
646 
647     /// Returns a vector containing the saturating subtraction of `self` and `rhs`.
648     ///
649     /// In other words this computes `[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]`.
650     #[inline]
651     #[must_use]
saturating_sub(self, rhs: Self) -> Self652     pub const fn saturating_sub(self, rhs: Self) -> Self {
653         Self {
654             x: self.x.saturating_sub(rhs.x),
655             y: self.y.saturating_sub(rhs.y),
656         }
657     }
658 
659     /// Returns a vector containing the saturating multiplication of `self` and `rhs`.
660     ///
661     /// In other words this computes `[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]`.
662     #[inline]
663     #[must_use]
saturating_mul(self, rhs: Self) -> Self664     pub const fn saturating_mul(self, rhs: Self) -> Self {
665         Self {
666             x: self.x.saturating_mul(rhs.x),
667             y: self.y.saturating_mul(rhs.y),
668         }
669     }
670 
671     /// Returns a vector containing the saturating division of `self` and `rhs`.
672     ///
673     /// In other words this computes `[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]`.
674     #[inline]
675     #[must_use]
saturating_div(self, rhs: Self) -> Self676     pub const fn saturating_div(self, rhs: Self) -> Self {
677         Self {
678             x: self.x.saturating_div(rhs.x),
679             y: self.y.saturating_div(rhs.y),
680         }
681     }
682 
683     /// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`.
684     ///
685     /// In other words this computes `Some([self.x + rhs.x, self.y + rhs.y, ..])` but returns `None` on any overflow.
686     #[inline]
687     #[must_use]
checked_add_unsigned(self, rhs: U8Vec2) -> Option<Self>688     pub const fn checked_add_unsigned(self, rhs: U8Vec2) -> Option<Self> {
689         let x = match self.x.checked_add_unsigned(rhs.x) {
690             Some(v) => v,
691             None => return None,
692         };
693         let y = match self.y.checked_add_unsigned(rhs.y) {
694             Some(v) => v,
695             None => return None,
696         };
697 
698         Some(Self { x, y })
699     }
700 
701     /// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`.
702     ///
703     /// In other words this computes `Some([self.x - rhs.x, self.y - rhs.y, ..])` but returns `None` on any overflow.
704     #[inline]
705     #[must_use]
checked_sub_unsigned(self, rhs: U8Vec2) -> Option<Self>706     pub const fn checked_sub_unsigned(self, rhs: U8Vec2) -> Option<Self> {
707         let x = match self.x.checked_sub_unsigned(rhs.x) {
708             Some(v) => v,
709             None => return None,
710         };
711         let y = match self.y.checked_sub_unsigned(rhs.y) {
712             Some(v) => v,
713             None => return None,
714         };
715 
716         Some(Self { x, y })
717     }
718 
719     /// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`.
720     ///
721     /// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`.
722     #[inline]
723     #[must_use]
wrapping_add_unsigned(self, rhs: U8Vec2) -> Self724     pub const fn wrapping_add_unsigned(self, rhs: U8Vec2) -> Self {
725         Self {
726             x: self.x.wrapping_add_unsigned(rhs.x),
727             y: self.y.wrapping_add_unsigned(rhs.y),
728         }
729     }
730 
731     /// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`.
732     ///
733     /// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`.
734     #[inline]
735     #[must_use]
wrapping_sub_unsigned(self, rhs: U8Vec2) -> Self736     pub const fn wrapping_sub_unsigned(self, rhs: U8Vec2) -> Self {
737         Self {
738             x: self.x.wrapping_sub_unsigned(rhs.x),
739             y: self.y.wrapping_sub_unsigned(rhs.y),
740         }
741     }
742 
743     // Returns a vector containing the saturating addition of `self` and unsigned vector `rhs`.
744     ///
745     /// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`.
746     #[inline]
747     #[must_use]
saturating_add_unsigned(self, rhs: U8Vec2) -> Self748     pub const fn saturating_add_unsigned(self, rhs: U8Vec2) -> Self {
749         Self {
750             x: self.x.saturating_add_unsigned(rhs.x),
751             y: self.y.saturating_add_unsigned(rhs.y),
752         }
753     }
754 
755     /// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`.
756     ///
757     /// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`.
758     #[inline]
759     #[must_use]
saturating_sub_unsigned(self, rhs: U8Vec2) -> Self760     pub const fn saturating_sub_unsigned(self, rhs: U8Vec2) -> Self {
761         Self {
762             x: self.x.saturating_sub_unsigned(rhs.x),
763             y: self.y.saturating_sub_unsigned(rhs.y),
764         }
765     }
766 }
767 
768 impl Default for I8Vec2 {
769     #[inline(always)]
default() -> Self770     fn default() -> Self {
771         Self::ZERO
772     }
773 }
774 
775 impl Div<I8Vec2> for I8Vec2 {
776     type Output = Self;
777     #[inline]
div(self, rhs: Self) -> Self778     fn div(self, rhs: Self) -> Self {
779         Self {
780             x: self.x.div(rhs.x),
781             y: self.y.div(rhs.y),
782         }
783     }
784 }
785 
786 impl Div<&I8Vec2> for I8Vec2 {
787     type Output = I8Vec2;
788     #[inline]
div(self, rhs: &I8Vec2) -> I8Vec2789     fn div(self, rhs: &I8Vec2) -> I8Vec2 {
790         self.div(*rhs)
791     }
792 }
793 
794 impl Div<&I8Vec2> for &I8Vec2 {
795     type Output = I8Vec2;
796     #[inline]
div(self, rhs: &I8Vec2) -> I8Vec2797     fn div(self, rhs: &I8Vec2) -> I8Vec2 {
798         (*self).div(*rhs)
799     }
800 }
801 
802 impl Div<I8Vec2> for &I8Vec2 {
803     type Output = I8Vec2;
804     #[inline]
div(self, rhs: I8Vec2) -> I8Vec2805     fn div(self, rhs: I8Vec2) -> I8Vec2 {
806         (*self).div(rhs)
807     }
808 }
809 
810 impl DivAssign<I8Vec2> for I8Vec2 {
811     #[inline]
div_assign(&mut self, rhs: Self)812     fn div_assign(&mut self, rhs: Self) {
813         self.x.div_assign(rhs.x);
814         self.y.div_assign(rhs.y);
815     }
816 }
817 
818 impl DivAssign<&I8Vec2> for I8Vec2 {
819     #[inline]
div_assign(&mut self, rhs: &I8Vec2)820     fn div_assign(&mut self, rhs: &I8Vec2) {
821         self.div_assign(*rhs)
822     }
823 }
824 
825 impl Div<i8> for I8Vec2 {
826     type Output = Self;
827     #[inline]
div(self, rhs: i8) -> Self828     fn div(self, rhs: i8) -> Self {
829         Self {
830             x: self.x.div(rhs),
831             y: self.y.div(rhs),
832         }
833     }
834 }
835 
836 impl Div<&i8> for I8Vec2 {
837     type Output = I8Vec2;
838     #[inline]
div(self, rhs: &i8) -> I8Vec2839     fn div(self, rhs: &i8) -> I8Vec2 {
840         self.div(*rhs)
841     }
842 }
843 
844 impl Div<&i8> for &I8Vec2 {
845     type Output = I8Vec2;
846     #[inline]
div(self, rhs: &i8) -> I8Vec2847     fn div(self, rhs: &i8) -> I8Vec2 {
848         (*self).div(*rhs)
849     }
850 }
851 
852 impl Div<i8> for &I8Vec2 {
853     type Output = I8Vec2;
854     #[inline]
div(self, rhs: i8) -> I8Vec2855     fn div(self, rhs: i8) -> I8Vec2 {
856         (*self).div(rhs)
857     }
858 }
859 
860 impl DivAssign<i8> for I8Vec2 {
861     #[inline]
div_assign(&mut self, rhs: i8)862     fn div_assign(&mut self, rhs: i8) {
863         self.x.div_assign(rhs);
864         self.y.div_assign(rhs);
865     }
866 }
867 
868 impl DivAssign<&i8> for I8Vec2 {
869     #[inline]
div_assign(&mut self, rhs: &i8)870     fn div_assign(&mut self, rhs: &i8) {
871         self.div_assign(*rhs)
872     }
873 }
874 
875 impl Div<I8Vec2> for i8 {
876     type Output = I8Vec2;
877     #[inline]
div(self, rhs: I8Vec2) -> I8Vec2878     fn div(self, rhs: I8Vec2) -> I8Vec2 {
879         I8Vec2 {
880             x: self.div(rhs.x),
881             y: self.div(rhs.y),
882         }
883     }
884 }
885 
886 impl Div<&I8Vec2> for i8 {
887     type Output = I8Vec2;
888     #[inline]
div(self, rhs: &I8Vec2) -> I8Vec2889     fn div(self, rhs: &I8Vec2) -> I8Vec2 {
890         self.div(*rhs)
891     }
892 }
893 
894 impl Div<&I8Vec2> for &i8 {
895     type Output = I8Vec2;
896     #[inline]
div(self, rhs: &I8Vec2) -> I8Vec2897     fn div(self, rhs: &I8Vec2) -> I8Vec2 {
898         (*self).div(*rhs)
899     }
900 }
901 
902 impl Div<I8Vec2> for &i8 {
903     type Output = I8Vec2;
904     #[inline]
div(self, rhs: I8Vec2) -> I8Vec2905     fn div(self, rhs: I8Vec2) -> I8Vec2 {
906         (*self).div(rhs)
907     }
908 }
909 
910 impl Mul<I8Vec2> for I8Vec2 {
911     type Output = Self;
912     #[inline]
mul(self, rhs: Self) -> Self913     fn mul(self, rhs: Self) -> Self {
914         Self {
915             x: self.x.mul(rhs.x),
916             y: self.y.mul(rhs.y),
917         }
918     }
919 }
920 
921 impl Mul<&I8Vec2> for I8Vec2 {
922     type Output = I8Vec2;
923     #[inline]
mul(self, rhs: &I8Vec2) -> I8Vec2924     fn mul(self, rhs: &I8Vec2) -> I8Vec2 {
925         self.mul(*rhs)
926     }
927 }
928 
929 impl Mul<&I8Vec2> for &I8Vec2 {
930     type Output = I8Vec2;
931     #[inline]
mul(self, rhs: &I8Vec2) -> I8Vec2932     fn mul(self, rhs: &I8Vec2) -> I8Vec2 {
933         (*self).mul(*rhs)
934     }
935 }
936 
937 impl Mul<I8Vec2> for &I8Vec2 {
938     type Output = I8Vec2;
939     #[inline]
mul(self, rhs: I8Vec2) -> I8Vec2940     fn mul(self, rhs: I8Vec2) -> I8Vec2 {
941         (*self).mul(rhs)
942     }
943 }
944 
945 impl MulAssign<I8Vec2> for I8Vec2 {
946     #[inline]
mul_assign(&mut self, rhs: Self)947     fn mul_assign(&mut self, rhs: Self) {
948         self.x.mul_assign(rhs.x);
949         self.y.mul_assign(rhs.y);
950     }
951 }
952 
953 impl MulAssign<&I8Vec2> for I8Vec2 {
954     #[inline]
mul_assign(&mut self, rhs: &I8Vec2)955     fn mul_assign(&mut self, rhs: &I8Vec2) {
956         self.mul_assign(*rhs)
957     }
958 }
959 
960 impl Mul<i8> for I8Vec2 {
961     type Output = Self;
962     #[inline]
mul(self, rhs: i8) -> Self963     fn mul(self, rhs: i8) -> Self {
964         Self {
965             x: self.x.mul(rhs),
966             y: self.y.mul(rhs),
967         }
968     }
969 }
970 
971 impl Mul<&i8> for I8Vec2 {
972     type Output = I8Vec2;
973     #[inline]
mul(self, rhs: &i8) -> I8Vec2974     fn mul(self, rhs: &i8) -> I8Vec2 {
975         self.mul(*rhs)
976     }
977 }
978 
979 impl Mul<&i8> for &I8Vec2 {
980     type Output = I8Vec2;
981     #[inline]
mul(self, rhs: &i8) -> I8Vec2982     fn mul(self, rhs: &i8) -> I8Vec2 {
983         (*self).mul(*rhs)
984     }
985 }
986 
987 impl Mul<i8> for &I8Vec2 {
988     type Output = I8Vec2;
989     #[inline]
mul(self, rhs: i8) -> I8Vec2990     fn mul(self, rhs: i8) -> I8Vec2 {
991         (*self).mul(rhs)
992     }
993 }
994 
995 impl MulAssign<i8> for I8Vec2 {
996     #[inline]
mul_assign(&mut self, rhs: i8)997     fn mul_assign(&mut self, rhs: i8) {
998         self.x.mul_assign(rhs);
999         self.y.mul_assign(rhs);
1000     }
1001 }
1002 
1003 impl MulAssign<&i8> for I8Vec2 {
1004     #[inline]
mul_assign(&mut self, rhs: &i8)1005     fn mul_assign(&mut self, rhs: &i8) {
1006         self.mul_assign(*rhs)
1007     }
1008 }
1009 
1010 impl Mul<I8Vec2> for i8 {
1011     type Output = I8Vec2;
1012     #[inline]
mul(self, rhs: I8Vec2) -> I8Vec21013     fn mul(self, rhs: I8Vec2) -> I8Vec2 {
1014         I8Vec2 {
1015             x: self.mul(rhs.x),
1016             y: self.mul(rhs.y),
1017         }
1018     }
1019 }
1020 
1021 impl Mul<&I8Vec2> for i8 {
1022     type Output = I8Vec2;
1023     #[inline]
mul(self, rhs: &I8Vec2) -> I8Vec21024     fn mul(self, rhs: &I8Vec2) -> I8Vec2 {
1025         self.mul(*rhs)
1026     }
1027 }
1028 
1029 impl Mul<&I8Vec2> for &i8 {
1030     type Output = I8Vec2;
1031     #[inline]
mul(self, rhs: &I8Vec2) -> I8Vec21032     fn mul(self, rhs: &I8Vec2) -> I8Vec2 {
1033         (*self).mul(*rhs)
1034     }
1035 }
1036 
1037 impl Mul<I8Vec2> for &i8 {
1038     type Output = I8Vec2;
1039     #[inline]
mul(self, rhs: I8Vec2) -> I8Vec21040     fn mul(self, rhs: I8Vec2) -> I8Vec2 {
1041         (*self).mul(rhs)
1042     }
1043 }
1044 
1045 impl Add<I8Vec2> for I8Vec2 {
1046     type Output = Self;
1047     #[inline]
add(self, rhs: Self) -> Self1048     fn add(self, rhs: Self) -> Self {
1049         Self {
1050             x: self.x.add(rhs.x),
1051             y: self.y.add(rhs.y),
1052         }
1053     }
1054 }
1055 
1056 impl Add<&I8Vec2> for I8Vec2 {
1057     type Output = I8Vec2;
1058     #[inline]
add(self, rhs: &I8Vec2) -> I8Vec21059     fn add(self, rhs: &I8Vec2) -> I8Vec2 {
1060         self.add(*rhs)
1061     }
1062 }
1063 
1064 impl Add<&I8Vec2> for &I8Vec2 {
1065     type Output = I8Vec2;
1066     #[inline]
add(self, rhs: &I8Vec2) -> I8Vec21067     fn add(self, rhs: &I8Vec2) -> I8Vec2 {
1068         (*self).add(*rhs)
1069     }
1070 }
1071 
1072 impl Add<I8Vec2> for &I8Vec2 {
1073     type Output = I8Vec2;
1074     #[inline]
add(self, rhs: I8Vec2) -> I8Vec21075     fn add(self, rhs: I8Vec2) -> I8Vec2 {
1076         (*self).add(rhs)
1077     }
1078 }
1079 
1080 impl AddAssign<I8Vec2> for I8Vec2 {
1081     #[inline]
add_assign(&mut self, rhs: Self)1082     fn add_assign(&mut self, rhs: Self) {
1083         self.x.add_assign(rhs.x);
1084         self.y.add_assign(rhs.y);
1085     }
1086 }
1087 
1088 impl AddAssign<&I8Vec2> for I8Vec2 {
1089     #[inline]
add_assign(&mut self, rhs: &I8Vec2)1090     fn add_assign(&mut self, rhs: &I8Vec2) {
1091         self.add_assign(*rhs)
1092     }
1093 }
1094 
1095 impl Add<i8> for I8Vec2 {
1096     type Output = Self;
1097     #[inline]
add(self, rhs: i8) -> Self1098     fn add(self, rhs: i8) -> Self {
1099         Self {
1100             x: self.x.add(rhs),
1101             y: self.y.add(rhs),
1102         }
1103     }
1104 }
1105 
1106 impl Add<&i8> for I8Vec2 {
1107     type Output = I8Vec2;
1108     #[inline]
add(self, rhs: &i8) -> I8Vec21109     fn add(self, rhs: &i8) -> I8Vec2 {
1110         self.add(*rhs)
1111     }
1112 }
1113 
1114 impl Add<&i8> for &I8Vec2 {
1115     type Output = I8Vec2;
1116     #[inline]
add(self, rhs: &i8) -> I8Vec21117     fn add(self, rhs: &i8) -> I8Vec2 {
1118         (*self).add(*rhs)
1119     }
1120 }
1121 
1122 impl Add<i8> for &I8Vec2 {
1123     type Output = I8Vec2;
1124     #[inline]
add(self, rhs: i8) -> I8Vec21125     fn add(self, rhs: i8) -> I8Vec2 {
1126         (*self).add(rhs)
1127     }
1128 }
1129 
1130 impl AddAssign<i8> for I8Vec2 {
1131     #[inline]
add_assign(&mut self, rhs: i8)1132     fn add_assign(&mut self, rhs: i8) {
1133         self.x.add_assign(rhs);
1134         self.y.add_assign(rhs);
1135     }
1136 }
1137 
1138 impl AddAssign<&i8> for I8Vec2 {
1139     #[inline]
add_assign(&mut self, rhs: &i8)1140     fn add_assign(&mut self, rhs: &i8) {
1141         self.add_assign(*rhs)
1142     }
1143 }
1144 
1145 impl Add<I8Vec2> for i8 {
1146     type Output = I8Vec2;
1147     #[inline]
add(self, rhs: I8Vec2) -> I8Vec21148     fn add(self, rhs: I8Vec2) -> I8Vec2 {
1149         I8Vec2 {
1150             x: self.add(rhs.x),
1151             y: self.add(rhs.y),
1152         }
1153     }
1154 }
1155 
1156 impl Add<&I8Vec2> for i8 {
1157     type Output = I8Vec2;
1158     #[inline]
add(self, rhs: &I8Vec2) -> I8Vec21159     fn add(self, rhs: &I8Vec2) -> I8Vec2 {
1160         self.add(*rhs)
1161     }
1162 }
1163 
1164 impl Add<&I8Vec2> for &i8 {
1165     type Output = I8Vec2;
1166     #[inline]
add(self, rhs: &I8Vec2) -> I8Vec21167     fn add(self, rhs: &I8Vec2) -> I8Vec2 {
1168         (*self).add(*rhs)
1169     }
1170 }
1171 
1172 impl Add<I8Vec2> for &i8 {
1173     type Output = I8Vec2;
1174     #[inline]
add(self, rhs: I8Vec2) -> I8Vec21175     fn add(self, rhs: I8Vec2) -> I8Vec2 {
1176         (*self).add(rhs)
1177     }
1178 }
1179 
1180 impl Sub<I8Vec2> for I8Vec2 {
1181     type Output = Self;
1182     #[inline]
sub(self, rhs: Self) -> Self1183     fn sub(self, rhs: Self) -> Self {
1184         Self {
1185             x: self.x.sub(rhs.x),
1186             y: self.y.sub(rhs.y),
1187         }
1188     }
1189 }
1190 
1191 impl Sub<&I8Vec2> for I8Vec2 {
1192     type Output = I8Vec2;
1193     #[inline]
sub(self, rhs: &I8Vec2) -> I8Vec21194     fn sub(self, rhs: &I8Vec2) -> I8Vec2 {
1195         self.sub(*rhs)
1196     }
1197 }
1198 
1199 impl Sub<&I8Vec2> for &I8Vec2 {
1200     type Output = I8Vec2;
1201     #[inline]
sub(self, rhs: &I8Vec2) -> I8Vec21202     fn sub(self, rhs: &I8Vec2) -> I8Vec2 {
1203         (*self).sub(*rhs)
1204     }
1205 }
1206 
1207 impl Sub<I8Vec2> for &I8Vec2 {
1208     type Output = I8Vec2;
1209     #[inline]
sub(self, rhs: I8Vec2) -> I8Vec21210     fn sub(self, rhs: I8Vec2) -> I8Vec2 {
1211         (*self).sub(rhs)
1212     }
1213 }
1214 
1215 impl SubAssign<I8Vec2> for I8Vec2 {
1216     #[inline]
sub_assign(&mut self, rhs: I8Vec2)1217     fn sub_assign(&mut self, rhs: I8Vec2) {
1218         self.x.sub_assign(rhs.x);
1219         self.y.sub_assign(rhs.y);
1220     }
1221 }
1222 
1223 impl SubAssign<&I8Vec2> for I8Vec2 {
1224     #[inline]
sub_assign(&mut self, rhs: &I8Vec2)1225     fn sub_assign(&mut self, rhs: &I8Vec2) {
1226         self.sub_assign(*rhs)
1227     }
1228 }
1229 
1230 impl Sub<i8> for I8Vec2 {
1231     type Output = Self;
1232     #[inline]
sub(self, rhs: i8) -> Self1233     fn sub(self, rhs: i8) -> Self {
1234         Self {
1235             x: self.x.sub(rhs),
1236             y: self.y.sub(rhs),
1237         }
1238     }
1239 }
1240 
1241 impl Sub<&i8> for I8Vec2 {
1242     type Output = I8Vec2;
1243     #[inline]
sub(self, rhs: &i8) -> I8Vec21244     fn sub(self, rhs: &i8) -> I8Vec2 {
1245         self.sub(*rhs)
1246     }
1247 }
1248 
1249 impl Sub<&i8> for &I8Vec2 {
1250     type Output = I8Vec2;
1251     #[inline]
sub(self, rhs: &i8) -> I8Vec21252     fn sub(self, rhs: &i8) -> I8Vec2 {
1253         (*self).sub(*rhs)
1254     }
1255 }
1256 
1257 impl Sub<i8> for &I8Vec2 {
1258     type Output = I8Vec2;
1259     #[inline]
sub(self, rhs: i8) -> I8Vec21260     fn sub(self, rhs: i8) -> I8Vec2 {
1261         (*self).sub(rhs)
1262     }
1263 }
1264 
1265 impl SubAssign<i8> for I8Vec2 {
1266     #[inline]
sub_assign(&mut self, rhs: i8)1267     fn sub_assign(&mut self, rhs: i8) {
1268         self.x.sub_assign(rhs);
1269         self.y.sub_assign(rhs);
1270     }
1271 }
1272 
1273 impl SubAssign<&i8> for I8Vec2 {
1274     #[inline]
sub_assign(&mut self, rhs: &i8)1275     fn sub_assign(&mut self, rhs: &i8) {
1276         self.sub_assign(*rhs)
1277     }
1278 }
1279 
1280 impl Sub<I8Vec2> for i8 {
1281     type Output = I8Vec2;
1282     #[inline]
sub(self, rhs: I8Vec2) -> I8Vec21283     fn sub(self, rhs: I8Vec2) -> I8Vec2 {
1284         I8Vec2 {
1285             x: self.sub(rhs.x),
1286             y: self.sub(rhs.y),
1287         }
1288     }
1289 }
1290 
1291 impl Sub<&I8Vec2> for i8 {
1292     type Output = I8Vec2;
1293     #[inline]
sub(self, rhs: &I8Vec2) -> I8Vec21294     fn sub(self, rhs: &I8Vec2) -> I8Vec2 {
1295         self.sub(*rhs)
1296     }
1297 }
1298 
1299 impl Sub<&I8Vec2> for &i8 {
1300     type Output = I8Vec2;
1301     #[inline]
sub(self, rhs: &I8Vec2) -> I8Vec21302     fn sub(self, rhs: &I8Vec2) -> I8Vec2 {
1303         (*self).sub(*rhs)
1304     }
1305 }
1306 
1307 impl Sub<I8Vec2> for &i8 {
1308     type Output = I8Vec2;
1309     #[inline]
sub(self, rhs: I8Vec2) -> I8Vec21310     fn sub(self, rhs: I8Vec2) -> I8Vec2 {
1311         (*self).sub(rhs)
1312     }
1313 }
1314 
1315 impl Rem<I8Vec2> for I8Vec2 {
1316     type Output = Self;
1317     #[inline]
rem(self, rhs: Self) -> Self1318     fn rem(self, rhs: Self) -> Self {
1319         Self {
1320             x: self.x.rem(rhs.x),
1321             y: self.y.rem(rhs.y),
1322         }
1323     }
1324 }
1325 
1326 impl Rem<&I8Vec2> for I8Vec2 {
1327     type Output = I8Vec2;
1328     #[inline]
rem(self, rhs: &I8Vec2) -> I8Vec21329     fn rem(self, rhs: &I8Vec2) -> I8Vec2 {
1330         self.rem(*rhs)
1331     }
1332 }
1333 
1334 impl Rem<&I8Vec2> for &I8Vec2 {
1335     type Output = I8Vec2;
1336     #[inline]
rem(self, rhs: &I8Vec2) -> I8Vec21337     fn rem(self, rhs: &I8Vec2) -> I8Vec2 {
1338         (*self).rem(*rhs)
1339     }
1340 }
1341 
1342 impl Rem<I8Vec2> for &I8Vec2 {
1343     type Output = I8Vec2;
1344     #[inline]
rem(self, rhs: I8Vec2) -> I8Vec21345     fn rem(self, rhs: I8Vec2) -> I8Vec2 {
1346         (*self).rem(rhs)
1347     }
1348 }
1349 
1350 impl RemAssign<I8Vec2> for I8Vec2 {
1351     #[inline]
rem_assign(&mut self, rhs: Self)1352     fn rem_assign(&mut self, rhs: Self) {
1353         self.x.rem_assign(rhs.x);
1354         self.y.rem_assign(rhs.y);
1355     }
1356 }
1357 
1358 impl RemAssign<&I8Vec2> for I8Vec2 {
1359     #[inline]
rem_assign(&mut self, rhs: &I8Vec2)1360     fn rem_assign(&mut self, rhs: &I8Vec2) {
1361         self.rem_assign(*rhs)
1362     }
1363 }
1364 
1365 impl Rem<i8> for I8Vec2 {
1366     type Output = Self;
1367     #[inline]
rem(self, rhs: i8) -> Self1368     fn rem(self, rhs: i8) -> Self {
1369         Self {
1370             x: self.x.rem(rhs),
1371             y: self.y.rem(rhs),
1372         }
1373     }
1374 }
1375 
1376 impl Rem<&i8> for I8Vec2 {
1377     type Output = I8Vec2;
1378     #[inline]
rem(self, rhs: &i8) -> I8Vec21379     fn rem(self, rhs: &i8) -> I8Vec2 {
1380         self.rem(*rhs)
1381     }
1382 }
1383 
1384 impl Rem<&i8> for &I8Vec2 {
1385     type Output = I8Vec2;
1386     #[inline]
rem(self, rhs: &i8) -> I8Vec21387     fn rem(self, rhs: &i8) -> I8Vec2 {
1388         (*self).rem(*rhs)
1389     }
1390 }
1391 
1392 impl Rem<i8> for &I8Vec2 {
1393     type Output = I8Vec2;
1394     #[inline]
rem(self, rhs: i8) -> I8Vec21395     fn rem(self, rhs: i8) -> I8Vec2 {
1396         (*self).rem(rhs)
1397     }
1398 }
1399 
1400 impl RemAssign<i8> for I8Vec2 {
1401     #[inline]
rem_assign(&mut self, rhs: i8)1402     fn rem_assign(&mut self, rhs: i8) {
1403         self.x.rem_assign(rhs);
1404         self.y.rem_assign(rhs);
1405     }
1406 }
1407 
1408 impl RemAssign<&i8> for I8Vec2 {
1409     #[inline]
rem_assign(&mut self, rhs: &i8)1410     fn rem_assign(&mut self, rhs: &i8) {
1411         self.rem_assign(*rhs)
1412     }
1413 }
1414 
1415 impl Rem<I8Vec2> for i8 {
1416     type Output = I8Vec2;
1417     #[inline]
rem(self, rhs: I8Vec2) -> I8Vec21418     fn rem(self, rhs: I8Vec2) -> I8Vec2 {
1419         I8Vec2 {
1420             x: self.rem(rhs.x),
1421             y: self.rem(rhs.y),
1422         }
1423     }
1424 }
1425 
1426 impl Rem<&I8Vec2> for i8 {
1427     type Output = I8Vec2;
1428     #[inline]
rem(self, rhs: &I8Vec2) -> I8Vec21429     fn rem(self, rhs: &I8Vec2) -> I8Vec2 {
1430         self.rem(*rhs)
1431     }
1432 }
1433 
1434 impl Rem<&I8Vec2> for &i8 {
1435     type Output = I8Vec2;
1436     #[inline]
rem(self, rhs: &I8Vec2) -> I8Vec21437     fn rem(self, rhs: &I8Vec2) -> I8Vec2 {
1438         (*self).rem(*rhs)
1439     }
1440 }
1441 
1442 impl Rem<I8Vec2> for &i8 {
1443     type Output = I8Vec2;
1444     #[inline]
rem(self, rhs: I8Vec2) -> I8Vec21445     fn rem(self, rhs: I8Vec2) -> I8Vec2 {
1446         (*self).rem(rhs)
1447     }
1448 }
1449 
1450 #[cfg(not(target_arch = "spirv"))]
1451 impl AsRef<[i8; 2]> for I8Vec2 {
1452     #[inline]
as_ref(&self) -> &[i8; 2]1453     fn as_ref(&self) -> &[i8; 2] {
1454         unsafe { &*(self as *const I8Vec2 as *const [i8; 2]) }
1455     }
1456 }
1457 
1458 #[cfg(not(target_arch = "spirv"))]
1459 impl AsMut<[i8; 2]> for I8Vec2 {
1460     #[inline]
as_mut(&mut self) -> &mut [i8; 2]1461     fn as_mut(&mut self) -> &mut [i8; 2] {
1462         unsafe { &mut *(self as *mut I8Vec2 as *mut [i8; 2]) }
1463     }
1464 }
1465 
1466 impl Sum for I8Vec2 {
1467     #[inline]
sum<I>(iter: I) -> Self where I: Iterator<Item = Self>,1468     fn sum<I>(iter: I) -> Self
1469     where
1470         I: Iterator<Item = Self>,
1471     {
1472         iter.fold(Self::ZERO, Self::add)
1473     }
1474 }
1475 
1476 impl<'a> Sum<&'a Self> for I8Vec2 {
1477     #[inline]
sum<I>(iter: I) -> Self where I: Iterator<Item = &'a Self>,1478     fn sum<I>(iter: I) -> Self
1479     where
1480         I: Iterator<Item = &'a Self>,
1481     {
1482         iter.fold(Self::ZERO, |a, &b| Self::add(a, b))
1483     }
1484 }
1485 
1486 impl Product for I8Vec2 {
1487     #[inline]
product<I>(iter: I) -> Self where I: Iterator<Item = Self>,1488     fn product<I>(iter: I) -> Self
1489     where
1490         I: Iterator<Item = Self>,
1491     {
1492         iter.fold(Self::ONE, Self::mul)
1493     }
1494 }
1495 
1496 impl<'a> Product<&'a Self> for I8Vec2 {
1497     #[inline]
product<I>(iter: I) -> Self where I: Iterator<Item = &'a Self>,1498     fn product<I>(iter: I) -> Self
1499     where
1500         I: Iterator<Item = &'a Self>,
1501     {
1502         iter.fold(Self::ONE, |a, &b| Self::mul(a, b))
1503     }
1504 }
1505 
1506 impl Neg for I8Vec2 {
1507     type Output = Self;
1508     #[inline]
neg(self) -> Self1509     fn neg(self) -> Self {
1510         Self {
1511             x: self.x.neg(),
1512             y: self.y.neg(),
1513         }
1514     }
1515 }
1516 
1517 impl Neg for &I8Vec2 {
1518     type Output = I8Vec2;
1519     #[inline]
neg(self) -> I8Vec21520     fn neg(self) -> I8Vec2 {
1521         (*self).neg()
1522     }
1523 }
1524 
1525 impl Not for I8Vec2 {
1526     type Output = Self;
1527     #[inline]
not(self) -> Self::Output1528     fn not(self) -> Self::Output {
1529         Self {
1530             x: self.x.not(),
1531             y: self.y.not(),
1532         }
1533     }
1534 }
1535 
1536 impl BitAnd for I8Vec2 {
1537     type Output = Self;
1538     #[inline]
bitand(self, rhs: Self) -> Self::Output1539     fn bitand(self, rhs: Self) -> Self::Output {
1540         Self {
1541             x: self.x.bitand(rhs.x),
1542             y: self.y.bitand(rhs.y),
1543         }
1544     }
1545 }
1546 
1547 impl BitOr for I8Vec2 {
1548     type Output = Self;
1549     #[inline]
bitor(self, rhs: Self) -> Self::Output1550     fn bitor(self, rhs: Self) -> Self::Output {
1551         Self {
1552             x: self.x.bitor(rhs.x),
1553             y: self.y.bitor(rhs.y),
1554         }
1555     }
1556 }
1557 
1558 impl BitXor for I8Vec2 {
1559     type Output = Self;
1560     #[inline]
bitxor(self, rhs: Self) -> Self::Output1561     fn bitxor(self, rhs: Self) -> Self::Output {
1562         Self {
1563             x: self.x.bitxor(rhs.x),
1564             y: self.y.bitxor(rhs.y),
1565         }
1566     }
1567 }
1568 
1569 impl BitAnd<i8> for I8Vec2 {
1570     type Output = Self;
1571     #[inline]
bitand(self, rhs: i8) -> Self::Output1572     fn bitand(self, rhs: i8) -> Self::Output {
1573         Self {
1574             x: self.x.bitand(rhs),
1575             y: self.y.bitand(rhs),
1576         }
1577     }
1578 }
1579 
1580 impl BitOr<i8> for I8Vec2 {
1581     type Output = Self;
1582     #[inline]
bitor(self, rhs: i8) -> Self::Output1583     fn bitor(self, rhs: i8) -> Self::Output {
1584         Self {
1585             x: self.x.bitor(rhs),
1586             y: self.y.bitor(rhs),
1587         }
1588     }
1589 }
1590 
1591 impl BitXor<i8> for I8Vec2 {
1592     type Output = Self;
1593     #[inline]
bitxor(self, rhs: i8) -> Self::Output1594     fn bitxor(self, rhs: i8) -> Self::Output {
1595         Self {
1596             x: self.x.bitxor(rhs),
1597             y: self.y.bitxor(rhs),
1598         }
1599     }
1600 }
1601 
1602 impl Shl<i8> for I8Vec2 {
1603     type Output = Self;
1604     #[inline]
shl(self, rhs: i8) -> Self::Output1605     fn shl(self, rhs: i8) -> Self::Output {
1606         Self {
1607             x: self.x.shl(rhs),
1608             y: self.y.shl(rhs),
1609         }
1610     }
1611 }
1612 
1613 impl Shr<i8> for I8Vec2 {
1614     type Output = Self;
1615     #[inline]
shr(self, rhs: i8) -> Self::Output1616     fn shr(self, rhs: i8) -> Self::Output {
1617         Self {
1618             x: self.x.shr(rhs),
1619             y: self.y.shr(rhs),
1620         }
1621     }
1622 }
1623 
1624 impl Shl<i16> for I8Vec2 {
1625     type Output = Self;
1626     #[inline]
shl(self, rhs: i16) -> Self::Output1627     fn shl(self, rhs: i16) -> Self::Output {
1628         Self {
1629             x: self.x.shl(rhs),
1630             y: self.y.shl(rhs),
1631         }
1632     }
1633 }
1634 
1635 impl Shr<i16> for I8Vec2 {
1636     type Output = Self;
1637     #[inline]
shr(self, rhs: i16) -> Self::Output1638     fn shr(self, rhs: i16) -> Self::Output {
1639         Self {
1640             x: self.x.shr(rhs),
1641             y: self.y.shr(rhs),
1642         }
1643     }
1644 }
1645 
1646 impl Shl<i32> for I8Vec2 {
1647     type Output = Self;
1648     #[inline]
shl(self, rhs: i32) -> Self::Output1649     fn shl(self, rhs: i32) -> Self::Output {
1650         Self {
1651             x: self.x.shl(rhs),
1652             y: self.y.shl(rhs),
1653         }
1654     }
1655 }
1656 
1657 impl Shr<i32> for I8Vec2 {
1658     type Output = Self;
1659     #[inline]
shr(self, rhs: i32) -> Self::Output1660     fn shr(self, rhs: i32) -> Self::Output {
1661         Self {
1662             x: self.x.shr(rhs),
1663             y: self.y.shr(rhs),
1664         }
1665     }
1666 }
1667 
1668 impl Shl<i64> for I8Vec2 {
1669     type Output = Self;
1670     #[inline]
shl(self, rhs: i64) -> Self::Output1671     fn shl(self, rhs: i64) -> Self::Output {
1672         Self {
1673             x: self.x.shl(rhs),
1674             y: self.y.shl(rhs),
1675         }
1676     }
1677 }
1678 
1679 impl Shr<i64> for I8Vec2 {
1680     type Output = Self;
1681     #[inline]
shr(self, rhs: i64) -> Self::Output1682     fn shr(self, rhs: i64) -> Self::Output {
1683         Self {
1684             x: self.x.shr(rhs),
1685             y: self.y.shr(rhs),
1686         }
1687     }
1688 }
1689 
1690 impl Shl<u8> for I8Vec2 {
1691     type Output = Self;
1692     #[inline]
shl(self, rhs: u8) -> Self::Output1693     fn shl(self, rhs: u8) -> Self::Output {
1694         Self {
1695             x: self.x.shl(rhs),
1696             y: self.y.shl(rhs),
1697         }
1698     }
1699 }
1700 
1701 impl Shr<u8> for I8Vec2 {
1702     type Output = Self;
1703     #[inline]
shr(self, rhs: u8) -> Self::Output1704     fn shr(self, rhs: u8) -> Self::Output {
1705         Self {
1706             x: self.x.shr(rhs),
1707             y: self.y.shr(rhs),
1708         }
1709     }
1710 }
1711 
1712 impl Shl<u16> for I8Vec2 {
1713     type Output = Self;
1714     #[inline]
shl(self, rhs: u16) -> Self::Output1715     fn shl(self, rhs: u16) -> Self::Output {
1716         Self {
1717             x: self.x.shl(rhs),
1718             y: self.y.shl(rhs),
1719         }
1720     }
1721 }
1722 
1723 impl Shr<u16> for I8Vec2 {
1724     type Output = Self;
1725     #[inline]
shr(self, rhs: u16) -> Self::Output1726     fn shr(self, rhs: u16) -> Self::Output {
1727         Self {
1728             x: self.x.shr(rhs),
1729             y: self.y.shr(rhs),
1730         }
1731     }
1732 }
1733 
1734 impl Shl<u32> for I8Vec2 {
1735     type Output = Self;
1736     #[inline]
shl(self, rhs: u32) -> Self::Output1737     fn shl(self, rhs: u32) -> Self::Output {
1738         Self {
1739             x: self.x.shl(rhs),
1740             y: self.y.shl(rhs),
1741         }
1742     }
1743 }
1744 
1745 impl Shr<u32> for I8Vec2 {
1746     type Output = Self;
1747     #[inline]
shr(self, rhs: u32) -> Self::Output1748     fn shr(self, rhs: u32) -> Self::Output {
1749         Self {
1750             x: self.x.shr(rhs),
1751             y: self.y.shr(rhs),
1752         }
1753     }
1754 }
1755 
1756 impl Shl<u64> for I8Vec2 {
1757     type Output = Self;
1758     #[inline]
shl(self, rhs: u64) -> Self::Output1759     fn shl(self, rhs: u64) -> Self::Output {
1760         Self {
1761             x: self.x.shl(rhs),
1762             y: self.y.shl(rhs),
1763         }
1764     }
1765 }
1766 
1767 impl Shr<u64> for I8Vec2 {
1768     type Output = Self;
1769     #[inline]
shr(self, rhs: u64) -> Self::Output1770     fn shr(self, rhs: u64) -> Self::Output {
1771         Self {
1772             x: self.x.shr(rhs),
1773             y: self.y.shr(rhs),
1774         }
1775     }
1776 }
1777 
1778 impl Shl<crate::IVec2> for I8Vec2 {
1779     type Output = Self;
1780     #[inline]
shl(self, rhs: crate::IVec2) -> Self::Output1781     fn shl(self, rhs: crate::IVec2) -> Self::Output {
1782         Self {
1783             x: self.x.shl(rhs.x),
1784             y: self.y.shl(rhs.y),
1785         }
1786     }
1787 }
1788 
1789 impl Shr<crate::IVec2> for I8Vec2 {
1790     type Output = Self;
1791     #[inline]
shr(self, rhs: crate::IVec2) -> Self::Output1792     fn shr(self, rhs: crate::IVec2) -> Self::Output {
1793         Self {
1794             x: self.x.shr(rhs.x),
1795             y: self.y.shr(rhs.y),
1796         }
1797     }
1798 }
1799 
1800 impl Shl<crate::UVec2> for I8Vec2 {
1801     type Output = Self;
1802     #[inline]
shl(self, rhs: crate::UVec2) -> Self::Output1803     fn shl(self, rhs: crate::UVec2) -> Self::Output {
1804         Self {
1805             x: self.x.shl(rhs.x),
1806             y: self.y.shl(rhs.y),
1807         }
1808     }
1809 }
1810 
1811 impl Shr<crate::UVec2> for I8Vec2 {
1812     type Output = Self;
1813     #[inline]
shr(self, rhs: crate::UVec2) -> Self::Output1814     fn shr(self, rhs: crate::UVec2) -> Self::Output {
1815         Self {
1816             x: self.x.shr(rhs.x),
1817             y: self.y.shr(rhs.y),
1818         }
1819     }
1820 }
1821 
1822 impl Index<usize> for I8Vec2 {
1823     type Output = i8;
1824     #[inline]
index(&self, index: usize) -> &Self::Output1825     fn index(&self, index: usize) -> &Self::Output {
1826         match index {
1827             0 => &self.x,
1828             1 => &self.y,
1829             _ => panic!("index out of bounds"),
1830         }
1831     }
1832 }
1833 
1834 impl IndexMut<usize> for I8Vec2 {
1835     #[inline]
index_mut(&mut self, index: usize) -> &mut Self::Output1836     fn index_mut(&mut self, index: usize) -> &mut Self::Output {
1837         match index {
1838             0 => &mut self.x,
1839             1 => &mut self.y,
1840             _ => panic!("index out of bounds"),
1841         }
1842     }
1843 }
1844 
1845 impl fmt::Display for I8Vec2 {
fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result1846     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1847         write!(f, "[{}, {}]", self.x, self.y)
1848     }
1849 }
1850 
1851 impl fmt::Debug for I8Vec2 {
fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result1852     fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
1853         fmt.debug_tuple(stringify!(I8Vec2))
1854             .field(&self.x)
1855             .field(&self.y)
1856             .finish()
1857     }
1858 }
1859 
1860 impl From<[i8; 2]> for I8Vec2 {
1861     #[inline]
from(a: [i8; 2]) -> Self1862     fn from(a: [i8; 2]) -> Self {
1863         Self::new(a[0], a[1])
1864     }
1865 }
1866 
1867 impl From<I8Vec2> for [i8; 2] {
1868     #[inline]
from(v: I8Vec2) -> Self1869     fn from(v: I8Vec2) -> Self {
1870         [v.x, v.y]
1871     }
1872 }
1873 
1874 impl From<(i8, i8)> for I8Vec2 {
1875     #[inline]
from(t: (i8, i8)) -> Self1876     fn from(t: (i8, i8)) -> Self {
1877         Self::new(t.0, t.1)
1878     }
1879 }
1880 
1881 impl From<I8Vec2> for (i8, i8) {
1882     #[inline]
from(v: I8Vec2) -> Self1883     fn from(v: I8Vec2) -> Self {
1884         (v.x, v.y)
1885     }
1886 }
1887 
1888 impl TryFrom<U8Vec2> for I8Vec2 {
1889     type Error = core::num::TryFromIntError;
1890 
1891     #[inline]
try_from(v: U8Vec2) -> Result<Self, Self::Error>1892     fn try_from(v: U8Vec2) -> Result<Self, Self::Error> {
1893         Ok(Self::new(i8::try_from(v.x)?, i8::try_from(v.y)?))
1894     }
1895 }
1896 
1897 impl TryFrom<I16Vec2> for I8Vec2 {
1898     type Error = core::num::TryFromIntError;
1899 
1900     #[inline]
try_from(v: I16Vec2) -> Result<Self, Self::Error>1901     fn try_from(v: I16Vec2) -> Result<Self, Self::Error> {
1902         Ok(Self::new(i8::try_from(v.x)?, i8::try_from(v.y)?))
1903     }
1904 }
1905 
1906 impl TryFrom<U16Vec2> for I8Vec2 {
1907     type Error = core::num::TryFromIntError;
1908 
1909     #[inline]
try_from(v: U16Vec2) -> Result<Self, Self::Error>1910     fn try_from(v: U16Vec2) -> Result<Self, Self::Error> {
1911         Ok(Self::new(i8::try_from(v.x)?, i8::try_from(v.y)?))
1912     }
1913 }
1914 
1915 impl TryFrom<IVec2> for I8Vec2 {
1916     type Error = core::num::TryFromIntError;
1917 
1918     #[inline]
try_from(v: IVec2) -> Result<Self, Self::Error>1919     fn try_from(v: IVec2) -> Result<Self, Self::Error> {
1920         Ok(Self::new(i8::try_from(v.x)?, i8::try_from(v.y)?))
1921     }
1922 }
1923 
1924 impl TryFrom<UVec2> for I8Vec2 {
1925     type Error = core::num::TryFromIntError;
1926 
1927     #[inline]
try_from(v: UVec2) -> Result<Self, Self::Error>1928     fn try_from(v: UVec2) -> Result<Self, Self::Error> {
1929         Ok(Self::new(i8::try_from(v.x)?, i8::try_from(v.y)?))
1930     }
1931 }
1932 
1933 impl TryFrom<I64Vec2> for I8Vec2 {
1934     type Error = core::num::TryFromIntError;
1935 
1936     #[inline]
try_from(v: I64Vec2) -> Result<Self, Self::Error>1937     fn try_from(v: I64Vec2) -> Result<Self, Self::Error> {
1938         Ok(Self::new(i8::try_from(v.x)?, i8::try_from(v.y)?))
1939     }
1940 }
1941 
1942 impl TryFrom<U64Vec2> for I8Vec2 {
1943     type Error = core::num::TryFromIntError;
1944 
1945     #[inline]
try_from(v: U64Vec2) -> Result<Self, Self::Error>1946     fn try_from(v: U64Vec2) -> Result<Self, Self::Error> {
1947         Ok(Self::new(i8::try_from(v.x)?, i8::try_from(v.y)?))
1948     }
1949 }
1950 
1951 impl From<BVec2> for I8Vec2 {
1952     #[inline]
from(v: BVec2) -> Self1953     fn from(v: BVec2) -> Self {
1954         Self::new(i8::from(v.x), i8::from(v.y))
1955     }
1956 }
1957