Skip to main content

glam/u16/
u16vec2.rs

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