Skip to main content

glam/i64/
i64vec2.rs

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