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