glam/u64/
u64vec2.rs

1// Generated from vec.rs.tera template. Edit the template, not the generated file.
2
3use crate::{BVec2, I16Vec2, I64Vec2, I8Vec2, IVec2, U16Vec2, U64Vec3, U8Vec2, USizeVec2, UVec2};
4
5use core::fmt;
6use core::iter::{Product, Sum};
7use core::{f32, ops::*};
8
9/// Creates a 2-dimensional vector.
10#[inline(always)]
11#[must_use]
12pub const fn u64vec2(x: u64, y: u64) -> U64Vec2 {
13    U64Vec2::new(x, y)
14}
15
16/// A 2-dimensional vector.
17#[cfg_attr(not(target_arch = "spirv"), derive(Hash))]
18#[derive(Clone, Copy, PartialEq, Eq)]
19#[cfg_attr(feature = "cuda", repr(align(16)))]
20#[cfg_attr(not(target_arch = "spirv"), repr(C))]
21#[cfg_attr(target_arch = "spirv", repr(simd))]
22pub struct U64Vec2 {
23    pub x: u64,
24    pub y: u64,
25}
26
27impl U64Vec2 {
28    /// All zeroes.
29    pub const ZERO: Self = Self::splat(0);
30
31    /// All ones.
32    pub const ONE: Self = Self::splat(1);
33
34    /// All `u64::MIN`.
35    pub const MIN: Self = Self::splat(u64::MIN);
36
37    /// All `u64::MAX`.
38    pub const MAX: Self = Self::splat(u64::MAX);
39
40    /// A unit vector pointing along the positive X axis.
41    pub const X: Self = Self::new(1, 0);
42
43    /// A unit vector pointing along the positive Y axis.
44    pub const Y: Self = Self::new(0, 1);
45
46    /// The unit axes.
47    pub const AXES: [Self; 2] = [Self::X, Self::Y];
48
49    /// Creates a new vector.
50    #[inline(always)]
51    #[must_use]
52    pub const fn new(x: u64, y: u64) -> Self {
53        Self { x, y }
54    }
55
56    /// Creates a vector with all elements set to `v`.
57    #[inline]
58    #[must_use]
59    pub const fn splat(v: u64) -> Self {
60        Self { x: v, y: v }
61    }
62
63    /// Returns a vector containing each element of `self` modified by a mapping function `f`.
64    #[inline]
65    #[must_use]
66    pub fn map<F>(self, f: F) -> Self
67    where
68        F: Fn(u64) -> u64,
69    {
70        Self::new(f(self.x), f(self.y))
71    }
72
73    /// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use
74    /// for each element of `self`.
75    ///
76    /// A true element in the mask uses the corresponding element from `if_true`, and false
77    /// uses the element from `if_false`.
78    #[inline]
79    #[must_use]
80    pub fn select(mask: BVec2, if_true: Self, if_false: Self) -> Self {
81        Self {
82            x: if mask.test(0) { if_true.x } else { if_false.x },
83            y: if mask.test(1) { if_true.y } else { if_false.y },
84        }
85    }
86
87    /// Creates a new vector from an array.
88    #[inline]
89    #[must_use]
90    pub const fn from_array(a: [u64; 2]) -> Self {
91        Self::new(a[0], a[1])
92    }
93
94    /// `[x, y]`
95    #[inline]
96    #[must_use]
97    pub const fn to_array(&self) -> [u64; 2] {
98        [self.x, self.y]
99    }
100
101    /// Creates a vector from the first 2 values in `slice`.
102    ///
103    /// # Panics
104    ///
105    /// Panics if `slice` is less than 2 elements long.
106    #[inline]
107    #[must_use]
108    pub const fn from_slice(slice: &[u64]) -> Self {
109        assert!(slice.len() >= 2);
110        Self::new(slice[0], slice[1])
111    }
112
113    /// Writes the elements of `self` to the first 2 elements in `slice`.
114    ///
115    /// # Panics
116    ///
117    /// Panics if `slice` is less than 2 elements long.
118    #[inline]
119    pub fn write_to_slice(self, slice: &mut [u64]) {
120        slice[..2].copy_from_slice(&self.to_array());
121    }
122
123    /// Creates a 3D vector from `self` and the given `z` value.
124    #[inline]
125    #[must_use]
126    pub const fn extend(self, z: u64) -> U64Vec3 {
127        U64Vec3::new(self.x, self.y, z)
128    }
129
130    /// Creates a 2D vector from `self` with the given value of `x`.
131    #[inline]
132    #[must_use]
133    pub fn with_x(mut self, x: u64) -> Self {
134        self.x = x;
135        self
136    }
137
138    /// Creates a 2D vector from `self` with the given value of `y`.
139    #[inline]
140    #[must_use]
141    pub fn with_y(mut self, y: u64) -> Self {
142        self.y = y;
143        self
144    }
145
146    /// Computes the dot product of `self` and `rhs`.
147    #[inline]
148    #[must_use]
149    pub fn dot(self, rhs: Self) -> u64 {
150        (self.x * rhs.x) + (self.y * rhs.y)
151    }
152
153    /// Returns a vector where every component is the dot product of `self` and `rhs`.
154    #[inline]
155    #[must_use]
156    pub fn dot_into_vec(self, rhs: Self) -> Self {
157        Self::splat(self.dot(rhs))
158    }
159
160    /// Returns a vector containing the minimum values for each element of `self` and `rhs`.
161    ///
162    /// In other words this computes `[min(x, rhs.x), min(self.y, rhs.y), ..]`.
163    #[inline]
164    #[must_use]
165    pub fn min(self, rhs: Self) -> Self {
166        Self {
167            x: if self.x < rhs.x { self.x } else { rhs.x },
168            y: if self.y < rhs.y { self.y } else { rhs.y },
169        }
170    }
171
172    /// Returns a vector containing the maximum values for each element of `self` and `rhs`.
173    ///
174    /// In other words this computes `[max(self.x, rhs.x), max(self.y, rhs.y), ..]`.
175    #[inline]
176    #[must_use]
177    pub fn max(self, rhs: Self) -> Self {
178        Self {
179            x: if self.x > rhs.x { self.x } else { rhs.x },
180            y: if self.y > rhs.y { self.y } else { rhs.y },
181        }
182    }
183
184    /// Component-wise clamping of values, similar to [`u64::clamp`].
185    ///
186    /// Each element in `min` must be less-or-equal to the corresponding element in `max`.
187    ///
188    /// # Panics
189    ///
190    /// Will panic if `min` is greater than `max` when `glam_assert` is enabled.
191    #[inline]
192    #[must_use]
193    pub fn clamp(self, min: Self, max: Self) -> Self {
194        glam_assert!(min.cmple(max).all(), "clamp: expected min <= max");
195        self.max(min).min(max)
196    }
197
198    /// Returns the horizontal minimum of `self`.
199    ///
200    /// In other words this computes `min(x, y, ..)`.
201    #[inline]
202    #[must_use]
203    pub fn min_element(self) -> u64 {
204        let min = |a, b| if a < b { a } else { b };
205        min(self.x, self.y)
206    }
207
208    /// Returns the horizontal maximum of `self`.
209    ///
210    /// In other words this computes `max(x, y, ..)`.
211    #[inline]
212    #[must_use]
213    pub fn max_element(self) -> u64 {
214        let max = |a, b| if a > b { a } else { b };
215        max(self.x, self.y)
216    }
217
218    /// Returns the index of the first minimum element of `self`.
219    #[doc(alias = "argmin")]
220    #[inline]
221    #[must_use]
222    pub fn min_position(self) -> usize {
223        if self.x <= self.y {
224            0
225        } else {
226            1
227        }
228    }
229
230    /// Returns the index of the first maximum element of `self`.
231    #[doc(alias = "argmax")]
232    #[inline]
233    #[must_use]
234    pub fn max_position(self) -> usize {
235        if self.x >= self.y {
236            0
237        } else {
238            1
239        }
240    }
241
242    /// Returns the sum of all elements of `self`.
243    ///
244    /// In other words, this computes `self.x + self.y + ..`.
245    #[inline]
246    #[must_use]
247    pub fn element_sum(self) -> u64 {
248        self.x + self.y
249    }
250
251    /// Returns the product of all elements of `self`.
252    ///
253    /// In other words, this computes `self.x * self.y * ..`.
254    #[inline]
255    #[must_use]
256    pub fn element_product(self) -> u64 {
257        self.x * self.y
258    }
259
260    /// Returns a vector mask containing the result of a `==` comparison for each element of
261    /// `self` and `rhs`.
262    ///
263    /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all
264    /// elements.
265    #[inline]
266    #[must_use]
267    pub fn cmpeq(self, rhs: Self) -> BVec2 {
268        BVec2::new(self.x.eq(&rhs.x), self.y.eq(&rhs.y))
269    }
270
271    /// Returns a vector mask containing the result of a `!=` comparison for each element of
272    /// `self` and `rhs`.
273    ///
274    /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all
275    /// elements.
276    #[inline]
277    #[must_use]
278    pub fn cmpne(self, rhs: Self) -> BVec2 {
279        BVec2::new(self.x.ne(&rhs.x), self.y.ne(&rhs.y))
280    }
281
282    /// Returns a vector mask containing the result of a `>=` comparison for each element of
283    /// `self` and `rhs`.
284    ///
285    /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all
286    /// elements.
287    #[inline]
288    #[must_use]
289    pub fn cmpge(self, rhs: Self) -> BVec2 {
290        BVec2::new(self.x.ge(&rhs.x), self.y.ge(&rhs.y))
291    }
292
293    /// Returns a vector mask containing the result of a `>` comparison for each element of
294    /// `self` and `rhs`.
295    ///
296    /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all
297    /// elements.
298    #[inline]
299    #[must_use]
300    pub fn cmpgt(self, rhs: Self) -> BVec2 {
301        BVec2::new(self.x.gt(&rhs.x), self.y.gt(&rhs.y))
302    }
303
304    /// Returns a vector mask containing the result of a `<=` comparison for each element of
305    /// `self` and `rhs`.
306    ///
307    /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all
308    /// elements.
309    #[inline]
310    #[must_use]
311    pub fn cmple(self, rhs: Self) -> BVec2 {
312        BVec2::new(self.x.le(&rhs.x), self.y.le(&rhs.y))
313    }
314
315    /// Returns a vector mask containing the result of a `<` comparison for each element of
316    /// `self` and `rhs`.
317    ///
318    /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all
319    /// elements.
320    #[inline]
321    #[must_use]
322    pub fn cmplt(self, rhs: Self) -> BVec2 {
323        BVec2::new(self.x.lt(&rhs.x), self.y.lt(&rhs.y))
324    }
325
326    /// Computes the squared length of `self`.
327    #[doc(alias = "magnitude2")]
328    #[inline]
329    #[must_use]
330    pub fn length_squared(self) -> u64 {
331        self.dot(self)
332    }
333
334    /// Computes the [manhattan distance] between two points.
335    ///
336    /// # Overflow
337    /// This method may overflow if the result is greater than [`u64::MAX`].
338    ///
339    /// See also [`checked_manhattan_distance`][U64Vec2::checked_manhattan_distance].
340    ///
341    /// [manhattan distance]: https://en.wikipedia.org/wiki/Taxicab_geometry
342    #[inline]
343    #[must_use]
344    pub fn manhattan_distance(self, other: Self) -> u64 {
345        self.x.abs_diff(other.x) + self.y.abs_diff(other.y)
346    }
347
348    /// Computes the [manhattan distance] between two points.
349    ///
350    /// This will returns [`None`] if the result is greater than [`u64::MAX`].
351    ///
352    /// [manhattan distance]: https://en.wikipedia.org/wiki/Taxicab_geometry
353    #[inline]
354    #[must_use]
355    pub fn checked_manhattan_distance(self, other: Self) -> Option<u64> {
356        let d = self.x.abs_diff(other.x);
357        d.checked_add(self.y.abs_diff(other.y))
358    }
359
360    /// Computes the [chebyshev distance] between two points.
361    ///
362    /// [chebyshev distance]: https://en.wikipedia.org/wiki/Chebyshev_distance
363    #[inline]
364    #[must_use]
365    pub fn chebyshev_distance(self, other: Self) -> u64 {
366        // Note: the compiler will eventually optimize out the loop
367        [self.x.abs_diff(other.x), self.y.abs_diff(other.y)]
368            .into_iter()
369            .max()
370            .unwrap()
371    }
372
373    /// Casts all elements of `self` to `f32`.
374    #[inline]
375    #[must_use]
376    pub fn as_vec2(&self) -> crate::Vec2 {
377        crate::Vec2::new(self.x as f32, self.y as f32)
378    }
379
380    /// Casts all elements of `self` to `f64`.
381    #[inline]
382    #[must_use]
383    pub fn as_dvec2(&self) -> crate::DVec2 {
384        crate::DVec2::new(self.x as f64, self.y as f64)
385    }
386
387    /// Casts all elements of `self` to `i8`.
388    #[inline]
389    #[must_use]
390    pub fn as_i8vec2(&self) -> crate::I8Vec2 {
391        crate::I8Vec2::new(self.x as i8, self.y as i8)
392    }
393
394    /// Casts all elements of `self` to `u8`.
395    #[inline]
396    #[must_use]
397    pub fn as_u8vec2(&self) -> crate::U8Vec2 {
398        crate::U8Vec2::new(self.x as u8, self.y as u8)
399    }
400
401    /// Casts all elements of `self` to `i16`.
402    #[inline]
403    #[must_use]
404    pub fn as_i16vec2(&self) -> crate::I16Vec2 {
405        crate::I16Vec2::new(self.x as i16, self.y as i16)
406    }
407
408    /// Casts all elements of `self` to `u16`.
409    #[inline]
410    #[must_use]
411    pub fn as_u16vec2(&self) -> crate::U16Vec2 {
412        crate::U16Vec2::new(self.x as u16, self.y as u16)
413    }
414
415    /// Casts all elements of `self` to `i32`.
416    #[inline]
417    #[must_use]
418    pub fn as_ivec2(&self) -> crate::IVec2 {
419        crate::IVec2::new(self.x as i32, self.y as i32)
420    }
421
422    /// Casts all elements of `self` to `u32`.
423    #[inline]
424    #[must_use]
425    pub fn as_uvec2(&self) -> crate::UVec2 {
426        crate::UVec2::new(self.x as u32, self.y as u32)
427    }
428
429    /// Casts all elements of `self` to `i64`.
430    #[inline]
431    #[must_use]
432    pub fn as_i64vec2(&self) -> crate::I64Vec2 {
433        crate::I64Vec2::new(self.x as i64, self.y as i64)
434    }
435
436    /// Casts all elements of `self` to `usize`.
437    #[inline]
438    #[must_use]
439    pub fn as_usizevec2(&self) -> crate::USizeVec2 {
440        crate::USizeVec2::new(self.x as usize, self.y as usize)
441    }
442
443    /// Returns a vector containing the wrapping addition of `self` and `rhs`.
444    ///
445    /// In other words this computes `Some([self.x + rhs.x, self.y + rhs.y, ..])` but returns `None` on any overflow.
446    #[inline]
447    #[must_use]
448    pub const fn checked_add(self, rhs: Self) -> Option<Self> {
449        let x = match self.x.checked_add(rhs.x) {
450            Some(v) => v,
451            None => return None,
452        };
453        let y = match self.y.checked_add(rhs.y) {
454            Some(v) => v,
455            None => return None,
456        };
457
458        Some(Self { x, y })
459    }
460
461    /// Returns a vector containing the wrapping subtraction of `self` and `rhs`.
462    ///
463    /// In other words this computes `Some([self.x - rhs.x, self.y - rhs.y, ..])` but returns `None` on any overflow.
464    #[inline]
465    #[must_use]
466    pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
467        let x = match self.x.checked_sub(rhs.x) {
468            Some(v) => v,
469            None => return None,
470        };
471        let y = match self.y.checked_sub(rhs.y) {
472            Some(v) => v,
473            None => return None,
474        };
475
476        Some(Self { x, y })
477    }
478
479    /// Returns a vector containing the wrapping multiplication of `self` and `rhs`.
480    ///
481    /// In other words this computes `Some([self.x * rhs.x, self.y * rhs.y, ..])` but returns `None` on any overflow.
482    #[inline]
483    #[must_use]
484    pub const fn checked_mul(self, rhs: Self) -> Option<Self> {
485        let x = match self.x.checked_mul(rhs.x) {
486            Some(v) => v,
487            None => return None,
488        };
489        let y = match self.y.checked_mul(rhs.y) {
490            Some(v) => v,
491            None => return None,
492        };
493
494        Some(Self { x, y })
495    }
496
497    /// Returns a vector containing the wrapping division of `self` and `rhs`.
498    ///
499    /// In other words this computes `Some([self.x / rhs.x, self.y / rhs.y, ..])` but returns `None` on any division by zero.
500    #[inline]
501    #[must_use]
502    pub const fn checked_div(self, rhs: Self) -> Option<Self> {
503        let x = match self.x.checked_div(rhs.x) {
504            Some(v) => v,
505            None => return None,
506        };
507        let y = match self.y.checked_div(rhs.y) {
508            Some(v) => v,
509            None => return None,
510        };
511
512        Some(Self { x, y })
513    }
514
515    /// Returns a vector containing the wrapping addition of `self` and `rhs`.
516    ///
517    /// In other words this computes `[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]`.
518    #[inline]
519    #[must_use]
520    pub const fn wrapping_add(self, rhs: Self) -> Self {
521        Self {
522            x: self.x.wrapping_add(rhs.x),
523            y: self.y.wrapping_add(rhs.y),
524        }
525    }
526
527    /// Returns a vector containing the wrapping subtraction of `self` and `rhs`.
528    ///
529    /// In other words this computes `[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]`.
530    #[inline]
531    #[must_use]
532    pub const fn wrapping_sub(self, rhs: Self) -> Self {
533        Self {
534            x: self.x.wrapping_sub(rhs.x),
535            y: self.y.wrapping_sub(rhs.y),
536        }
537    }
538
539    /// Returns a vector containing the wrapping multiplication of `self` and `rhs`.
540    ///
541    /// In other words this computes `[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]`.
542    #[inline]
543    #[must_use]
544    pub const fn wrapping_mul(self, rhs: Self) -> Self {
545        Self {
546            x: self.x.wrapping_mul(rhs.x),
547            y: self.y.wrapping_mul(rhs.y),
548        }
549    }
550
551    /// Returns a vector containing the wrapping division of `self` and `rhs`.
552    ///
553    /// In other words this computes `[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]`.
554    #[inline]
555    #[must_use]
556    pub const fn wrapping_div(self, rhs: Self) -> Self {
557        Self {
558            x: self.x.wrapping_div(rhs.x),
559            y: self.y.wrapping_div(rhs.y),
560        }
561    }
562
563    /// Returns a vector containing the saturating addition of `self` and `rhs`.
564    ///
565    /// In other words this computes `[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]`.
566    #[inline]
567    #[must_use]
568    pub const fn saturating_add(self, rhs: Self) -> Self {
569        Self {
570            x: self.x.saturating_add(rhs.x),
571            y: self.y.saturating_add(rhs.y),
572        }
573    }
574
575    /// Returns a vector containing the saturating subtraction of `self` and `rhs`.
576    ///
577    /// In other words this computes `[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]`.
578    #[inline]
579    #[must_use]
580    pub const fn saturating_sub(self, rhs: Self) -> Self {
581        Self {
582            x: self.x.saturating_sub(rhs.x),
583            y: self.y.saturating_sub(rhs.y),
584        }
585    }
586
587    /// Returns a vector containing the saturating multiplication of `self` and `rhs`.
588    ///
589    /// In other words this computes `[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]`.
590    #[inline]
591    #[must_use]
592    pub const fn saturating_mul(self, rhs: Self) -> Self {
593        Self {
594            x: self.x.saturating_mul(rhs.x),
595            y: self.y.saturating_mul(rhs.y),
596        }
597    }
598
599    /// Returns a vector containing the saturating division of `self` and `rhs`.
600    ///
601    /// In other words this computes `[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]`.
602    #[inline]
603    #[must_use]
604    pub const fn saturating_div(self, rhs: Self) -> Self {
605        Self {
606            x: self.x.saturating_div(rhs.x),
607            y: self.y.saturating_div(rhs.y),
608        }
609    }
610
611    /// Returns a vector containing the wrapping addition of `self` and signed vector `rhs`.
612    ///
613    /// In other words this computes `Some([self.x + rhs.x, self.y + rhs.y, ..])` but returns `None` on any overflow.
614    #[inline]
615    #[must_use]
616    pub const fn checked_add_signed(self, rhs: I64Vec2) -> Option<Self> {
617        let x = match self.x.checked_add_signed(rhs.x) {
618            Some(v) => v,
619            None => return None,
620        };
621        let y = match self.y.checked_add_signed(rhs.y) {
622            Some(v) => v,
623            None => return None,
624        };
625
626        Some(Self { x, y })
627    }
628
629    /// Returns a vector containing the wrapping addition of `self` and signed vector `rhs`.
630    ///
631    /// In other words this computes `[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]`.
632    #[inline]
633    #[must_use]
634    pub const fn wrapping_add_signed(self, rhs: I64Vec2) -> Self {
635        Self {
636            x: self.x.wrapping_add_signed(rhs.x),
637            y: self.y.wrapping_add_signed(rhs.y),
638        }
639    }
640
641    /// Returns a vector containing the saturating addition of `self` and signed vector `rhs`.
642    ///
643    /// In other words this computes `[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]`.
644    #[inline]
645    #[must_use]
646    pub const fn saturating_add_signed(self, rhs: I64Vec2) -> Self {
647        Self {
648            x: self.x.saturating_add_signed(rhs.x),
649            y: self.y.saturating_add_signed(rhs.y),
650        }
651    }
652}
653
654impl Default for U64Vec2 {
655    #[inline(always)]
656    fn default() -> Self {
657        Self::ZERO
658    }
659}
660
661impl Div<U64Vec2> for U64Vec2 {
662    type Output = Self;
663    #[inline]
664    fn div(self, rhs: Self) -> Self {
665        Self {
666            x: self.x.div(rhs.x),
667            y: self.y.div(rhs.y),
668        }
669    }
670}
671
672impl Div<&U64Vec2> for U64Vec2 {
673    type Output = U64Vec2;
674    #[inline]
675    fn div(self, rhs: &U64Vec2) -> U64Vec2 {
676        self.div(*rhs)
677    }
678}
679
680impl Div<&U64Vec2> for &U64Vec2 {
681    type Output = U64Vec2;
682    #[inline]
683    fn div(self, rhs: &U64Vec2) -> U64Vec2 {
684        (*self).div(*rhs)
685    }
686}
687
688impl Div<U64Vec2> for &U64Vec2 {
689    type Output = U64Vec2;
690    #[inline]
691    fn div(self, rhs: U64Vec2) -> U64Vec2 {
692        (*self).div(rhs)
693    }
694}
695
696impl DivAssign<U64Vec2> for U64Vec2 {
697    #[inline]
698    fn div_assign(&mut self, rhs: Self) {
699        self.x.div_assign(rhs.x);
700        self.y.div_assign(rhs.y);
701    }
702}
703
704impl DivAssign<&U64Vec2> for U64Vec2 {
705    #[inline]
706    fn div_assign(&mut self, rhs: &U64Vec2) {
707        self.div_assign(*rhs)
708    }
709}
710
711impl Div<u64> for U64Vec2 {
712    type Output = Self;
713    #[inline]
714    fn div(self, rhs: u64) -> Self {
715        Self {
716            x: self.x.div(rhs),
717            y: self.y.div(rhs),
718        }
719    }
720}
721
722impl Div<&u64> for U64Vec2 {
723    type Output = U64Vec2;
724    #[inline]
725    fn div(self, rhs: &u64) -> U64Vec2 {
726        self.div(*rhs)
727    }
728}
729
730impl Div<&u64> for &U64Vec2 {
731    type Output = U64Vec2;
732    #[inline]
733    fn div(self, rhs: &u64) -> U64Vec2 {
734        (*self).div(*rhs)
735    }
736}
737
738impl Div<u64> for &U64Vec2 {
739    type Output = U64Vec2;
740    #[inline]
741    fn div(self, rhs: u64) -> U64Vec2 {
742        (*self).div(rhs)
743    }
744}
745
746impl DivAssign<u64> for U64Vec2 {
747    #[inline]
748    fn div_assign(&mut self, rhs: u64) {
749        self.x.div_assign(rhs);
750        self.y.div_assign(rhs);
751    }
752}
753
754impl DivAssign<&u64> for U64Vec2 {
755    #[inline]
756    fn div_assign(&mut self, rhs: &u64) {
757        self.div_assign(*rhs)
758    }
759}
760
761impl Div<U64Vec2> for u64 {
762    type Output = U64Vec2;
763    #[inline]
764    fn div(self, rhs: U64Vec2) -> U64Vec2 {
765        U64Vec2 {
766            x: self.div(rhs.x),
767            y: self.div(rhs.y),
768        }
769    }
770}
771
772impl Div<&U64Vec2> for u64 {
773    type Output = U64Vec2;
774    #[inline]
775    fn div(self, rhs: &U64Vec2) -> U64Vec2 {
776        self.div(*rhs)
777    }
778}
779
780impl Div<&U64Vec2> for &u64 {
781    type Output = U64Vec2;
782    #[inline]
783    fn div(self, rhs: &U64Vec2) -> U64Vec2 {
784        (*self).div(*rhs)
785    }
786}
787
788impl Div<U64Vec2> for &u64 {
789    type Output = U64Vec2;
790    #[inline]
791    fn div(self, rhs: U64Vec2) -> U64Vec2 {
792        (*self).div(rhs)
793    }
794}
795
796impl Mul<U64Vec2> for U64Vec2 {
797    type Output = Self;
798    #[inline]
799    fn mul(self, rhs: Self) -> Self {
800        Self {
801            x: self.x.mul(rhs.x),
802            y: self.y.mul(rhs.y),
803        }
804    }
805}
806
807impl Mul<&U64Vec2> for U64Vec2 {
808    type Output = U64Vec2;
809    #[inline]
810    fn mul(self, rhs: &U64Vec2) -> U64Vec2 {
811        self.mul(*rhs)
812    }
813}
814
815impl Mul<&U64Vec2> for &U64Vec2 {
816    type Output = U64Vec2;
817    #[inline]
818    fn mul(self, rhs: &U64Vec2) -> U64Vec2 {
819        (*self).mul(*rhs)
820    }
821}
822
823impl Mul<U64Vec2> for &U64Vec2 {
824    type Output = U64Vec2;
825    #[inline]
826    fn mul(self, rhs: U64Vec2) -> U64Vec2 {
827        (*self).mul(rhs)
828    }
829}
830
831impl MulAssign<U64Vec2> for U64Vec2 {
832    #[inline]
833    fn mul_assign(&mut self, rhs: Self) {
834        self.x.mul_assign(rhs.x);
835        self.y.mul_assign(rhs.y);
836    }
837}
838
839impl MulAssign<&U64Vec2> for U64Vec2 {
840    #[inline]
841    fn mul_assign(&mut self, rhs: &U64Vec2) {
842        self.mul_assign(*rhs)
843    }
844}
845
846impl Mul<u64> for U64Vec2 {
847    type Output = Self;
848    #[inline]
849    fn mul(self, rhs: u64) -> Self {
850        Self {
851            x: self.x.mul(rhs),
852            y: self.y.mul(rhs),
853        }
854    }
855}
856
857impl Mul<&u64> for U64Vec2 {
858    type Output = U64Vec2;
859    #[inline]
860    fn mul(self, rhs: &u64) -> U64Vec2 {
861        self.mul(*rhs)
862    }
863}
864
865impl Mul<&u64> for &U64Vec2 {
866    type Output = U64Vec2;
867    #[inline]
868    fn mul(self, rhs: &u64) -> U64Vec2 {
869        (*self).mul(*rhs)
870    }
871}
872
873impl Mul<u64> for &U64Vec2 {
874    type Output = U64Vec2;
875    #[inline]
876    fn mul(self, rhs: u64) -> U64Vec2 {
877        (*self).mul(rhs)
878    }
879}
880
881impl MulAssign<u64> for U64Vec2 {
882    #[inline]
883    fn mul_assign(&mut self, rhs: u64) {
884        self.x.mul_assign(rhs);
885        self.y.mul_assign(rhs);
886    }
887}
888
889impl MulAssign<&u64> for U64Vec2 {
890    #[inline]
891    fn mul_assign(&mut self, rhs: &u64) {
892        self.mul_assign(*rhs)
893    }
894}
895
896impl Mul<U64Vec2> for u64 {
897    type Output = U64Vec2;
898    #[inline]
899    fn mul(self, rhs: U64Vec2) -> U64Vec2 {
900        U64Vec2 {
901            x: self.mul(rhs.x),
902            y: self.mul(rhs.y),
903        }
904    }
905}
906
907impl Mul<&U64Vec2> for u64 {
908    type Output = U64Vec2;
909    #[inline]
910    fn mul(self, rhs: &U64Vec2) -> U64Vec2 {
911        self.mul(*rhs)
912    }
913}
914
915impl Mul<&U64Vec2> for &u64 {
916    type Output = U64Vec2;
917    #[inline]
918    fn mul(self, rhs: &U64Vec2) -> U64Vec2 {
919        (*self).mul(*rhs)
920    }
921}
922
923impl Mul<U64Vec2> for &u64 {
924    type Output = U64Vec2;
925    #[inline]
926    fn mul(self, rhs: U64Vec2) -> U64Vec2 {
927        (*self).mul(rhs)
928    }
929}
930
931impl Add<U64Vec2> for U64Vec2 {
932    type Output = Self;
933    #[inline]
934    fn add(self, rhs: Self) -> Self {
935        Self {
936            x: self.x.add(rhs.x),
937            y: self.y.add(rhs.y),
938        }
939    }
940}
941
942impl Add<&U64Vec2> for U64Vec2 {
943    type Output = U64Vec2;
944    #[inline]
945    fn add(self, rhs: &U64Vec2) -> U64Vec2 {
946        self.add(*rhs)
947    }
948}
949
950impl Add<&U64Vec2> for &U64Vec2 {
951    type Output = U64Vec2;
952    #[inline]
953    fn add(self, rhs: &U64Vec2) -> U64Vec2 {
954        (*self).add(*rhs)
955    }
956}
957
958impl Add<U64Vec2> for &U64Vec2 {
959    type Output = U64Vec2;
960    #[inline]
961    fn add(self, rhs: U64Vec2) -> U64Vec2 {
962        (*self).add(rhs)
963    }
964}
965
966impl AddAssign<U64Vec2> for U64Vec2 {
967    #[inline]
968    fn add_assign(&mut self, rhs: Self) {
969        self.x.add_assign(rhs.x);
970        self.y.add_assign(rhs.y);
971    }
972}
973
974impl AddAssign<&U64Vec2> for U64Vec2 {
975    #[inline]
976    fn add_assign(&mut self, rhs: &U64Vec2) {
977        self.add_assign(*rhs)
978    }
979}
980
981impl Add<u64> for U64Vec2 {
982    type Output = Self;
983    #[inline]
984    fn add(self, rhs: u64) -> Self {
985        Self {
986            x: self.x.add(rhs),
987            y: self.y.add(rhs),
988        }
989    }
990}
991
992impl Add<&u64> for U64Vec2 {
993    type Output = U64Vec2;
994    #[inline]
995    fn add(self, rhs: &u64) -> U64Vec2 {
996        self.add(*rhs)
997    }
998}
999
1000impl Add<&u64> for &U64Vec2 {
1001    type Output = U64Vec2;
1002    #[inline]
1003    fn add(self, rhs: &u64) -> U64Vec2 {
1004        (*self).add(*rhs)
1005    }
1006}
1007
1008impl Add<u64> for &U64Vec2 {
1009    type Output = U64Vec2;
1010    #[inline]
1011    fn add(self, rhs: u64) -> U64Vec2 {
1012        (*self).add(rhs)
1013    }
1014}
1015
1016impl AddAssign<u64> for U64Vec2 {
1017    #[inline]
1018    fn add_assign(&mut self, rhs: u64) {
1019        self.x.add_assign(rhs);
1020        self.y.add_assign(rhs);
1021    }
1022}
1023
1024impl AddAssign<&u64> for U64Vec2 {
1025    #[inline]
1026    fn add_assign(&mut self, rhs: &u64) {
1027        self.add_assign(*rhs)
1028    }
1029}
1030
1031impl Add<U64Vec2> for u64 {
1032    type Output = U64Vec2;
1033    #[inline]
1034    fn add(self, rhs: U64Vec2) -> U64Vec2 {
1035        U64Vec2 {
1036            x: self.add(rhs.x),
1037            y: self.add(rhs.y),
1038        }
1039    }
1040}
1041
1042impl Add<&U64Vec2> for u64 {
1043    type Output = U64Vec2;
1044    #[inline]
1045    fn add(self, rhs: &U64Vec2) -> U64Vec2 {
1046        self.add(*rhs)
1047    }
1048}
1049
1050impl Add<&U64Vec2> for &u64 {
1051    type Output = U64Vec2;
1052    #[inline]
1053    fn add(self, rhs: &U64Vec2) -> U64Vec2 {
1054        (*self).add(*rhs)
1055    }
1056}
1057
1058impl Add<U64Vec2> for &u64 {
1059    type Output = U64Vec2;
1060    #[inline]
1061    fn add(self, rhs: U64Vec2) -> U64Vec2 {
1062        (*self).add(rhs)
1063    }
1064}
1065
1066impl Sub<U64Vec2> for U64Vec2 {
1067    type Output = Self;
1068    #[inline]
1069    fn sub(self, rhs: Self) -> Self {
1070        Self {
1071            x: self.x.sub(rhs.x),
1072            y: self.y.sub(rhs.y),
1073        }
1074    }
1075}
1076
1077impl Sub<&U64Vec2> for U64Vec2 {
1078    type Output = U64Vec2;
1079    #[inline]
1080    fn sub(self, rhs: &U64Vec2) -> U64Vec2 {
1081        self.sub(*rhs)
1082    }
1083}
1084
1085impl Sub<&U64Vec2> for &U64Vec2 {
1086    type Output = U64Vec2;
1087    #[inline]
1088    fn sub(self, rhs: &U64Vec2) -> U64Vec2 {
1089        (*self).sub(*rhs)
1090    }
1091}
1092
1093impl Sub<U64Vec2> for &U64Vec2 {
1094    type Output = U64Vec2;
1095    #[inline]
1096    fn sub(self, rhs: U64Vec2) -> U64Vec2 {
1097        (*self).sub(rhs)
1098    }
1099}
1100
1101impl SubAssign<U64Vec2> for U64Vec2 {
1102    #[inline]
1103    fn sub_assign(&mut self, rhs: U64Vec2) {
1104        self.x.sub_assign(rhs.x);
1105        self.y.sub_assign(rhs.y);
1106    }
1107}
1108
1109impl SubAssign<&U64Vec2> for U64Vec2 {
1110    #[inline]
1111    fn sub_assign(&mut self, rhs: &U64Vec2) {
1112        self.sub_assign(*rhs)
1113    }
1114}
1115
1116impl Sub<u64> for U64Vec2 {
1117    type Output = Self;
1118    #[inline]
1119    fn sub(self, rhs: u64) -> Self {
1120        Self {
1121            x: self.x.sub(rhs),
1122            y: self.y.sub(rhs),
1123        }
1124    }
1125}
1126
1127impl Sub<&u64> for U64Vec2 {
1128    type Output = U64Vec2;
1129    #[inline]
1130    fn sub(self, rhs: &u64) -> U64Vec2 {
1131        self.sub(*rhs)
1132    }
1133}
1134
1135impl Sub<&u64> for &U64Vec2 {
1136    type Output = U64Vec2;
1137    #[inline]
1138    fn sub(self, rhs: &u64) -> U64Vec2 {
1139        (*self).sub(*rhs)
1140    }
1141}
1142
1143impl Sub<u64> for &U64Vec2 {
1144    type Output = U64Vec2;
1145    #[inline]
1146    fn sub(self, rhs: u64) -> U64Vec2 {
1147        (*self).sub(rhs)
1148    }
1149}
1150
1151impl SubAssign<u64> for U64Vec2 {
1152    #[inline]
1153    fn sub_assign(&mut self, rhs: u64) {
1154        self.x.sub_assign(rhs);
1155        self.y.sub_assign(rhs);
1156    }
1157}
1158
1159impl SubAssign<&u64> for U64Vec2 {
1160    #[inline]
1161    fn sub_assign(&mut self, rhs: &u64) {
1162        self.sub_assign(*rhs)
1163    }
1164}
1165
1166impl Sub<U64Vec2> for u64 {
1167    type Output = U64Vec2;
1168    #[inline]
1169    fn sub(self, rhs: U64Vec2) -> U64Vec2 {
1170        U64Vec2 {
1171            x: self.sub(rhs.x),
1172            y: self.sub(rhs.y),
1173        }
1174    }
1175}
1176
1177impl Sub<&U64Vec2> for u64 {
1178    type Output = U64Vec2;
1179    #[inline]
1180    fn sub(self, rhs: &U64Vec2) -> U64Vec2 {
1181        self.sub(*rhs)
1182    }
1183}
1184
1185impl Sub<&U64Vec2> for &u64 {
1186    type Output = U64Vec2;
1187    #[inline]
1188    fn sub(self, rhs: &U64Vec2) -> U64Vec2 {
1189        (*self).sub(*rhs)
1190    }
1191}
1192
1193impl Sub<U64Vec2> for &u64 {
1194    type Output = U64Vec2;
1195    #[inline]
1196    fn sub(self, rhs: U64Vec2) -> U64Vec2 {
1197        (*self).sub(rhs)
1198    }
1199}
1200
1201impl Rem<U64Vec2> for U64Vec2 {
1202    type Output = Self;
1203    #[inline]
1204    fn rem(self, rhs: Self) -> Self {
1205        Self {
1206            x: self.x.rem(rhs.x),
1207            y: self.y.rem(rhs.y),
1208        }
1209    }
1210}
1211
1212impl Rem<&U64Vec2> for U64Vec2 {
1213    type Output = U64Vec2;
1214    #[inline]
1215    fn rem(self, rhs: &U64Vec2) -> U64Vec2 {
1216        self.rem(*rhs)
1217    }
1218}
1219
1220impl Rem<&U64Vec2> for &U64Vec2 {
1221    type Output = U64Vec2;
1222    #[inline]
1223    fn rem(self, rhs: &U64Vec2) -> U64Vec2 {
1224        (*self).rem(*rhs)
1225    }
1226}
1227
1228impl Rem<U64Vec2> for &U64Vec2 {
1229    type Output = U64Vec2;
1230    #[inline]
1231    fn rem(self, rhs: U64Vec2) -> U64Vec2 {
1232        (*self).rem(rhs)
1233    }
1234}
1235
1236impl RemAssign<U64Vec2> for U64Vec2 {
1237    #[inline]
1238    fn rem_assign(&mut self, rhs: Self) {
1239        self.x.rem_assign(rhs.x);
1240        self.y.rem_assign(rhs.y);
1241    }
1242}
1243
1244impl RemAssign<&U64Vec2> for U64Vec2 {
1245    #[inline]
1246    fn rem_assign(&mut self, rhs: &U64Vec2) {
1247        self.rem_assign(*rhs)
1248    }
1249}
1250
1251impl Rem<u64> for U64Vec2 {
1252    type Output = Self;
1253    #[inline]
1254    fn rem(self, rhs: u64) -> Self {
1255        Self {
1256            x: self.x.rem(rhs),
1257            y: self.y.rem(rhs),
1258        }
1259    }
1260}
1261
1262impl Rem<&u64> for U64Vec2 {
1263    type Output = U64Vec2;
1264    #[inline]
1265    fn rem(self, rhs: &u64) -> U64Vec2 {
1266        self.rem(*rhs)
1267    }
1268}
1269
1270impl Rem<&u64> for &U64Vec2 {
1271    type Output = U64Vec2;
1272    #[inline]
1273    fn rem(self, rhs: &u64) -> U64Vec2 {
1274        (*self).rem(*rhs)
1275    }
1276}
1277
1278impl Rem<u64> for &U64Vec2 {
1279    type Output = U64Vec2;
1280    #[inline]
1281    fn rem(self, rhs: u64) -> U64Vec2 {
1282        (*self).rem(rhs)
1283    }
1284}
1285
1286impl RemAssign<u64> for U64Vec2 {
1287    #[inline]
1288    fn rem_assign(&mut self, rhs: u64) {
1289        self.x.rem_assign(rhs);
1290        self.y.rem_assign(rhs);
1291    }
1292}
1293
1294impl RemAssign<&u64> for U64Vec2 {
1295    #[inline]
1296    fn rem_assign(&mut self, rhs: &u64) {
1297        self.rem_assign(*rhs)
1298    }
1299}
1300
1301impl Rem<U64Vec2> for u64 {
1302    type Output = U64Vec2;
1303    #[inline]
1304    fn rem(self, rhs: U64Vec2) -> U64Vec2 {
1305        U64Vec2 {
1306            x: self.rem(rhs.x),
1307            y: self.rem(rhs.y),
1308        }
1309    }
1310}
1311
1312impl Rem<&U64Vec2> for u64 {
1313    type Output = U64Vec2;
1314    #[inline]
1315    fn rem(self, rhs: &U64Vec2) -> U64Vec2 {
1316        self.rem(*rhs)
1317    }
1318}
1319
1320impl Rem<&U64Vec2> for &u64 {
1321    type Output = U64Vec2;
1322    #[inline]
1323    fn rem(self, rhs: &U64Vec2) -> U64Vec2 {
1324        (*self).rem(*rhs)
1325    }
1326}
1327
1328impl Rem<U64Vec2> for &u64 {
1329    type Output = U64Vec2;
1330    #[inline]
1331    fn rem(self, rhs: U64Vec2) -> U64Vec2 {
1332        (*self).rem(rhs)
1333    }
1334}
1335
1336#[cfg(not(target_arch = "spirv"))]
1337impl AsRef<[u64; 2]> for U64Vec2 {
1338    #[inline]
1339    fn as_ref(&self) -> &[u64; 2] {
1340        unsafe { &*(self as *const U64Vec2 as *const [u64; 2]) }
1341    }
1342}
1343
1344#[cfg(not(target_arch = "spirv"))]
1345impl AsMut<[u64; 2]> for U64Vec2 {
1346    #[inline]
1347    fn as_mut(&mut self) -> &mut [u64; 2] {
1348        unsafe { &mut *(self as *mut U64Vec2 as *mut [u64; 2]) }
1349    }
1350}
1351
1352impl Sum for U64Vec2 {
1353    #[inline]
1354    fn sum<I>(iter: I) -> Self
1355    where
1356        I: Iterator<Item = Self>,
1357    {
1358        iter.fold(Self::ZERO, Self::add)
1359    }
1360}
1361
1362impl<'a> Sum<&'a Self> for U64Vec2 {
1363    #[inline]
1364    fn sum<I>(iter: I) -> Self
1365    where
1366        I: Iterator<Item = &'a Self>,
1367    {
1368        iter.fold(Self::ZERO, |a, &b| Self::add(a, b))
1369    }
1370}
1371
1372impl Product for U64Vec2 {
1373    #[inline]
1374    fn product<I>(iter: I) -> Self
1375    where
1376        I: Iterator<Item = Self>,
1377    {
1378        iter.fold(Self::ONE, Self::mul)
1379    }
1380}
1381
1382impl<'a> Product<&'a Self> for U64Vec2 {
1383    #[inline]
1384    fn product<I>(iter: I) -> Self
1385    where
1386        I: Iterator<Item = &'a Self>,
1387    {
1388        iter.fold(Self::ONE, |a, &b| Self::mul(a, b))
1389    }
1390}
1391
1392impl Not for U64Vec2 {
1393    type Output = Self;
1394    #[inline]
1395    fn not(self) -> Self::Output {
1396        Self {
1397            x: self.x.not(),
1398            y: self.y.not(),
1399        }
1400    }
1401}
1402
1403impl BitAnd for U64Vec2 {
1404    type Output = Self;
1405    #[inline]
1406    fn bitand(self, rhs: Self) -> Self::Output {
1407        Self {
1408            x: self.x.bitand(rhs.x),
1409            y: self.y.bitand(rhs.y),
1410        }
1411    }
1412}
1413
1414impl BitOr for U64Vec2 {
1415    type Output = Self;
1416    #[inline]
1417    fn bitor(self, rhs: Self) -> Self::Output {
1418        Self {
1419            x: self.x.bitor(rhs.x),
1420            y: self.y.bitor(rhs.y),
1421        }
1422    }
1423}
1424
1425impl BitXor for U64Vec2 {
1426    type Output = Self;
1427    #[inline]
1428    fn bitxor(self, rhs: Self) -> Self::Output {
1429        Self {
1430            x: self.x.bitxor(rhs.x),
1431            y: self.y.bitxor(rhs.y),
1432        }
1433    }
1434}
1435
1436impl BitAnd<u64> for U64Vec2 {
1437    type Output = Self;
1438    #[inline]
1439    fn bitand(self, rhs: u64) -> Self::Output {
1440        Self {
1441            x: self.x.bitand(rhs),
1442            y: self.y.bitand(rhs),
1443        }
1444    }
1445}
1446
1447impl BitOr<u64> for U64Vec2 {
1448    type Output = Self;
1449    #[inline]
1450    fn bitor(self, rhs: u64) -> Self::Output {
1451        Self {
1452            x: self.x.bitor(rhs),
1453            y: self.y.bitor(rhs),
1454        }
1455    }
1456}
1457
1458impl BitXor<u64> for U64Vec2 {
1459    type Output = Self;
1460    #[inline]
1461    fn bitxor(self, rhs: u64) -> Self::Output {
1462        Self {
1463            x: self.x.bitxor(rhs),
1464            y: self.y.bitxor(rhs),
1465        }
1466    }
1467}
1468
1469impl Shl<i8> for U64Vec2 {
1470    type Output = Self;
1471    #[inline]
1472    fn shl(self, rhs: i8) -> Self::Output {
1473        Self {
1474            x: self.x.shl(rhs),
1475            y: self.y.shl(rhs),
1476        }
1477    }
1478}
1479
1480impl Shr<i8> for U64Vec2 {
1481    type Output = Self;
1482    #[inline]
1483    fn shr(self, rhs: i8) -> Self::Output {
1484        Self {
1485            x: self.x.shr(rhs),
1486            y: self.y.shr(rhs),
1487        }
1488    }
1489}
1490
1491impl Shl<i16> for U64Vec2 {
1492    type Output = Self;
1493    #[inline]
1494    fn shl(self, rhs: i16) -> Self::Output {
1495        Self {
1496            x: self.x.shl(rhs),
1497            y: self.y.shl(rhs),
1498        }
1499    }
1500}
1501
1502impl Shr<i16> for U64Vec2 {
1503    type Output = Self;
1504    #[inline]
1505    fn shr(self, rhs: i16) -> Self::Output {
1506        Self {
1507            x: self.x.shr(rhs),
1508            y: self.y.shr(rhs),
1509        }
1510    }
1511}
1512
1513impl Shl<i32> for U64Vec2 {
1514    type Output = Self;
1515    #[inline]
1516    fn shl(self, rhs: i32) -> Self::Output {
1517        Self {
1518            x: self.x.shl(rhs),
1519            y: self.y.shl(rhs),
1520        }
1521    }
1522}
1523
1524impl Shr<i32> for U64Vec2 {
1525    type Output = Self;
1526    #[inline]
1527    fn shr(self, rhs: i32) -> Self::Output {
1528        Self {
1529            x: self.x.shr(rhs),
1530            y: self.y.shr(rhs),
1531        }
1532    }
1533}
1534
1535impl Shl<i64> for U64Vec2 {
1536    type Output = Self;
1537    #[inline]
1538    fn shl(self, rhs: i64) -> Self::Output {
1539        Self {
1540            x: self.x.shl(rhs),
1541            y: self.y.shl(rhs),
1542        }
1543    }
1544}
1545
1546impl Shr<i64> for U64Vec2 {
1547    type Output = Self;
1548    #[inline]
1549    fn shr(self, rhs: i64) -> Self::Output {
1550        Self {
1551            x: self.x.shr(rhs),
1552            y: self.y.shr(rhs),
1553        }
1554    }
1555}
1556
1557impl Shl<u8> for U64Vec2 {
1558    type Output = Self;
1559    #[inline]
1560    fn shl(self, rhs: u8) -> Self::Output {
1561        Self {
1562            x: self.x.shl(rhs),
1563            y: self.y.shl(rhs),
1564        }
1565    }
1566}
1567
1568impl Shr<u8> for U64Vec2 {
1569    type Output = Self;
1570    #[inline]
1571    fn shr(self, rhs: u8) -> Self::Output {
1572        Self {
1573            x: self.x.shr(rhs),
1574            y: self.y.shr(rhs),
1575        }
1576    }
1577}
1578
1579impl Shl<u16> for U64Vec2 {
1580    type Output = Self;
1581    #[inline]
1582    fn shl(self, rhs: u16) -> Self::Output {
1583        Self {
1584            x: self.x.shl(rhs),
1585            y: self.y.shl(rhs),
1586        }
1587    }
1588}
1589
1590impl Shr<u16> for U64Vec2 {
1591    type Output = Self;
1592    #[inline]
1593    fn shr(self, rhs: u16) -> Self::Output {
1594        Self {
1595            x: self.x.shr(rhs),
1596            y: self.y.shr(rhs),
1597        }
1598    }
1599}
1600
1601impl Shl<u32> for U64Vec2 {
1602    type Output = Self;
1603    #[inline]
1604    fn shl(self, rhs: u32) -> Self::Output {
1605        Self {
1606            x: self.x.shl(rhs),
1607            y: self.y.shl(rhs),
1608        }
1609    }
1610}
1611
1612impl Shr<u32> for U64Vec2 {
1613    type Output = Self;
1614    #[inline]
1615    fn shr(self, rhs: u32) -> Self::Output {
1616        Self {
1617            x: self.x.shr(rhs),
1618            y: self.y.shr(rhs),
1619        }
1620    }
1621}
1622
1623impl Shl<u64> for U64Vec2 {
1624    type Output = Self;
1625    #[inline]
1626    fn shl(self, rhs: u64) -> Self::Output {
1627        Self {
1628            x: self.x.shl(rhs),
1629            y: self.y.shl(rhs),
1630        }
1631    }
1632}
1633
1634impl Shr<u64> for U64Vec2 {
1635    type Output = Self;
1636    #[inline]
1637    fn shr(self, rhs: u64) -> Self::Output {
1638        Self {
1639            x: self.x.shr(rhs),
1640            y: self.y.shr(rhs),
1641        }
1642    }
1643}
1644
1645impl Shl<crate::IVec2> for U64Vec2 {
1646    type Output = Self;
1647    #[inline]
1648    fn shl(self, rhs: crate::IVec2) -> Self::Output {
1649        Self {
1650            x: self.x.shl(rhs.x),
1651            y: self.y.shl(rhs.y),
1652        }
1653    }
1654}
1655
1656impl Shr<crate::IVec2> for U64Vec2 {
1657    type Output = Self;
1658    #[inline]
1659    fn shr(self, rhs: crate::IVec2) -> Self::Output {
1660        Self {
1661            x: self.x.shr(rhs.x),
1662            y: self.y.shr(rhs.y),
1663        }
1664    }
1665}
1666
1667impl Shl<crate::UVec2> for U64Vec2 {
1668    type Output = Self;
1669    #[inline]
1670    fn shl(self, rhs: crate::UVec2) -> Self::Output {
1671        Self {
1672            x: self.x.shl(rhs.x),
1673            y: self.y.shl(rhs.y),
1674        }
1675    }
1676}
1677
1678impl Shr<crate::UVec2> for U64Vec2 {
1679    type Output = Self;
1680    #[inline]
1681    fn shr(self, rhs: crate::UVec2) -> Self::Output {
1682        Self {
1683            x: self.x.shr(rhs.x),
1684            y: self.y.shr(rhs.y),
1685        }
1686    }
1687}
1688
1689impl Index<usize> for U64Vec2 {
1690    type Output = u64;
1691    #[inline]
1692    fn index(&self, index: usize) -> &Self::Output {
1693        match index {
1694            0 => &self.x,
1695            1 => &self.y,
1696            _ => panic!("index out of bounds"),
1697        }
1698    }
1699}
1700
1701impl IndexMut<usize> for U64Vec2 {
1702    #[inline]
1703    fn index_mut(&mut self, index: usize) -> &mut Self::Output {
1704        match index {
1705            0 => &mut self.x,
1706            1 => &mut self.y,
1707            _ => panic!("index out of bounds"),
1708        }
1709    }
1710}
1711
1712impl fmt::Display for U64Vec2 {
1713    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1714        write!(f, "[{}, {}]", self.x, self.y)
1715    }
1716}
1717
1718impl fmt::Debug for U64Vec2 {
1719    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
1720        fmt.debug_tuple(stringify!(U64Vec2))
1721            .field(&self.x)
1722            .field(&self.y)
1723            .finish()
1724    }
1725}
1726
1727impl From<[u64; 2]> for U64Vec2 {
1728    #[inline]
1729    fn from(a: [u64; 2]) -> Self {
1730        Self::new(a[0], a[1])
1731    }
1732}
1733
1734impl From<U64Vec2> for [u64; 2] {
1735    #[inline]
1736    fn from(v: U64Vec2) -> Self {
1737        [v.x, v.y]
1738    }
1739}
1740
1741impl From<(u64, u64)> for U64Vec2 {
1742    #[inline]
1743    fn from(t: (u64, u64)) -> Self {
1744        Self::new(t.0, t.1)
1745    }
1746}
1747
1748impl From<U64Vec2> for (u64, u64) {
1749    #[inline]
1750    fn from(v: U64Vec2) -> Self {
1751        (v.x, v.y)
1752    }
1753}
1754
1755impl From<U8Vec2> for U64Vec2 {
1756    #[inline]
1757    fn from(v: U8Vec2) -> Self {
1758        Self::new(u64::from(v.x), u64::from(v.y))
1759    }
1760}
1761
1762impl From<U16Vec2> for U64Vec2 {
1763    #[inline]
1764    fn from(v: U16Vec2) -> Self {
1765        Self::new(u64::from(v.x), u64::from(v.y))
1766    }
1767}
1768
1769impl From<UVec2> for U64Vec2 {
1770    #[inline]
1771    fn from(v: UVec2) -> Self {
1772        Self::new(u64::from(v.x), u64::from(v.y))
1773    }
1774}
1775
1776impl TryFrom<I8Vec2> for U64Vec2 {
1777    type Error = core::num::TryFromIntError;
1778
1779    #[inline]
1780    fn try_from(v: I8Vec2) -> Result<Self, Self::Error> {
1781        Ok(Self::new(u64::try_from(v.x)?, u64::try_from(v.y)?))
1782    }
1783}
1784
1785impl TryFrom<I16Vec2> for U64Vec2 {
1786    type Error = core::num::TryFromIntError;
1787
1788    #[inline]
1789    fn try_from(v: I16Vec2) -> Result<Self, Self::Error> {
1790        Ok(Self::new(u64::try_from(v.x)?, u64::try_from(v.y)?))
1791    }
1792}
1793
1794impl TryFrom<IVec2> for U64Vec2 {
1795    type Error = core::num::TryFromIntError;
1796
1797    #[inline]
1798    fn try_from(v: IVec2) -> Result<Self, Self::Error> {
1799        Ok(Self::new(u64::try_from(v.x)?, u64::try_from(v.y)?))
1800    }
1801}
1802
1803impl TryFrom<I64Vec2> for U64Vec2 {
1804    type Error = core::num::TryFromIntError;
1805
1806    #[inline]
1807    fn try_from(v: I64Vec2) -> Result<Self, Self::Error> {
1808        Ok(Self::new(u64::try_from(v.x)?, u64::try_from(v.y)?))
1809    }
1810}
1811
1812impl TryFrom<USizeVec2> for U64Vec2 {
1813    type Error = core::num::TryFromIntError;
1814
1815    #[inline]
1816    fn try_from(v: USizeVec2) -> Result<Self, Self::Error> {
1817        Ok(Self::new(u64::try_from(v.x)?, u64::try_from(v.y)?))
1818    }
1819}
1820
1821impl From<BVec2> for U64Vec2 {
1822    #[inline]
1823    fn from(v: BVec2) -> Self {
1824        Self::new(u64::from(v.x), u64::from(v.y))
1825    }
1826}