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::{f32, ops::*};
35
36#[cfg(feature = "zerocopy")]
37use zerocopy_derive::*;
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",
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 { x: v, y: 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 {
116            x: if mask.test(0) { if_true.x } else { if_false.x },
117            y: 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 {
201            x: if self.x < rhs.x { self.x } else { rhs.x },
202            y: 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 {
213            x: if self.x > rhs.x { self.x } else { rhs.x },
214            y: 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 {
720            x: self.x.div(rhs.x),
721            y: self.y.div(rhs.y),
722        }
723    }
724}
725
726impl Div<&Self> for U16Vec2 {
727    type Output = Self;
728    #[inline]
729    fn div(self, rhs: &Self) -> Self {
730        self.div(*rhs)
731    }
732}
733
734impl Div<&U16Vec2> for &U16Vec2 {
735    type Output = U16Vec2;
736    #[inline]
737    fn div(self, rhs: &U16Vec2) -> U16Vec2 {
738        (*self).div(*rhs)
739    }
740}
741
742impl Div<U16Vec2> for &U16Vec2 {
743    type Output = U16Vec2;
744    #[inline]
745    fn div(self, rhs: U16Vec2) -> U16Vec2 {
746        (*self).div(rhs)
747    }
748}
749
750impl DivAssign for U16Vec2 {
751    #[inline]
752    fn div_assign(&mut self, rhs: Self) {
753        self.x.div_assign(rhs.x);
754        self.y.div_assign(rhs.y);
755    }
756}
757
758impl DivAssign<&Self> for U16Vec2 {
759    #[inline]
760    fn div_assign(&mut self, rhs: &Self) {
761        self.div_assign(*rhs);
762    }
763}
764
765impl Div<u16> for U16Vec2 {
766    type Output = Self;
767    #[inline]
768    fn div(self, rhs: u16) -> Self {
769        Self {
770            x: self.x.div(rhs),
771            y: self.y.div(rhs),
772        }
773    }
774}
775
776impl Div<&u16> for U16Vec2 {
777    type Output = Self;
778    #[inline]
779    fn div(self, rhs: &u16) -> Self {
780        self.div(*rhs)
781    }
782}
783
784impl Div<&u16> for &U16Vec2 {
785    type Output = U16Vec2;
786    #[inline]
787    fn div(self, rhs: &u16) -> U16Vec2 {
788        (*self).div(*rhs)
789    }
790}
791
792impl Div<u16> for &U16Vec2 {
793    type Output = U16Vec2;
794    #[inline]
795    fn div(self, rhs: u16) -> U16Vec2 {
796        (*self).div(rhs)
797    }
798}
799
800impl DivAssign<u16> for U16Vec2 {
801    #[inline]
802    fn div_assign(&mut self, rhs: u16) {
803        self.x.div_assign(rhs);
804        self.y.div_assign(rhs);
805    }
806}
807
808impl DivAssign<&u16> for U16Vec2 {
809    #[inline]
810    fn div_assign(&mut self, rhs: &u16) {
811        self.div_assign(*rhs);
812    }
813}
814
815impl Div<U16Vec2> for u16 {
816    type Output = U16Vec2;
817    #[inline]
818    fn div(self, rhs: U16Vec2) -> U16Vec2 {
819        U16Vec2 {
820            x: self.div(rhs.x),
821            y: self.div(rhs.y),
822        }
823    }
824}
825
826impl Div<&U16Vec2> for u16 {
827    type Output = U16Vec2;
828    #[inline]
829    fn div(self, rhs: &U16Vec2) -> U16Vec2 {
830        self.div(*rhs)
831    }
832}
833
834impl Div<&U16Vec2> for &u16 {
835    type Output = U16Vec2;
836    #[inline]
837    fn div(self, rhs: &U16Vec2) -> U16Vec2 {
838        (*self).div(*rhs)
839    }
840}
841
842impl Div<U16Vec2> for &u16 {
843    type Output = U16Vec2;
844    #[inline]
845    fn div(self, rhs: U16Vec2) -> U16Vec2 {
846        (*self).div(rhs)
847    }
848}
849
850impl Mul for U16Vec2 {
851    type Output = Self;
852    #[inline]
853    fn mul(self, rhs: Self) -> Self {
854        Self {
855            x: self.x.mul(rhs.x),
856            y: self.y.mul(rhs.y),
857        }
858    }
859}
860
861impl Mul<&Self> for U16Vec2 {
862    type Output = Self;
863    #[inline]
864    fn mul(self, rhs: &Self) -> Self {
865        self.mul(*rhs)
866    }
867}
868
869impl Mul<&U16Vec2> for &U16Vec2 {
870    type Output = U16Vec2;
871    #[inline]
872    fn mul(self, rhs: &U16Vec2) -> U16Vec2 {
873        (*self).mul(*rhs)
874    }
875}
876
877impl Mul<U16Vec2> for &U16Vec2 {
878    type Output = U16Vec2;
879    #[inline]
880    fn mul(self, rhs: U16Vec2) -> U16Vec2 {
881        (*self).mul(rhs)
882    }
883}
884
885impl MulAssign for U16Vec2 {
886    #[inline]
887    fn mul_assign(&mut self, rhs: Self) {
888        self.x.mul_assign(rhs.x);
889        self.y.mul_assign(rhs.y);
890    }
891}
892
893impl MulAssign<&Self> for U16Vec2 {
894    #[inline]
895    fn mul_assign(&mut self, rhs: &Self) {
896        self.mul_assign(*rhs);
897    }
898}
899
900impl Mul<u16> for U16Vec2 {
901    type Output = Self;
902    #[inline]
903    fn mul(self, rhs: u16) -> Self {
904        Self {
905            x: self.x.mul(rhs),
906            y: self.y.mul(rhs),
907        }
908    }
909}
910
911impl Mul<&u16> for U16Vec2 {
912    type Output = Self;
913    #[inline]
914    fn mul(self, rhs: &u16) -> Self {
915        self.mul(*rhs)
916    }
917}
918
919impl Mul<&u16> for &U16Vec2 {
920    type Output = U16Vec2;
921    #[inline]
922    fn mul(self, rhs: &u16) -> U16Vec2 {
923        (*self).mul(*rhs)
924    }
925}
926
927impl Mul<u16> for &U16Vec2 {
928    type Output = U16Vec2;
929    #[inline]
930    fn mul(self, rhs: u16) -> U16Vec2 {
931        (*self).mul(rhs)
932    }
933}
934
935impl MulAssign<u16> for U16Vec2 {
936    #[inline]
937    fn mul_assign(&mut self, rhs: u16) {
938        self.x.mul_assign(rhs);
939        self.y.mul_assign(rhs);
940    }
941}
942
943impl MulAssign<&u16> for U16Vec2 {
944    #[inline]
945    fn mul_assign(&mut self, rhs: &u16) {
946        self.mul_assign(*rhs);
947    }
948}
949
950impl Mul<U16Vec2> for u16 {
951    type Output = U16Vec2;
952    #[inline]
953    fn mul(self, rhs: U16Vec2) -> U16Vec2 {
954        U16Vec2 {
955            x: self.mul(rhs.x),
956            y: self.mul(rhs.y),
957        }
958    }
959}
960
961impl Mul<&U16Vec2> for u16 {
962    type Output = U16Vec2;
963    #[inline]
964    fn mul(self, rhs: &U16Vec2) -> U16Vec2 {
965        self.mul(*rhs)
966    }
967}
968
969impl Mul<&U16Vec2> for &u16 {
970    type Output = U16Vec2;
971    #[inline]
972    fn mul(self, rhs: &U16Vec2) -> U16Vec2 {
973        (*self).mul(*rhs)
974    }
975}
976
977impl Mul<U16Vec2> for &u16 {
978    type Output = U16Vec2;
979    #[inline]
980    fn mul(self, rhs: U16Vec2) -> U16Vec2 {
981        (*self).mul(rhs)
982    }
983}
984
985impl Add for U16Vec2 {
986    type Output = Self;
987    #[inline]
988    fn add(self, rhs: Self) -> Self {
989        Self {
990            x: self.x.add(rhs.x),
991            y: self.y.add(rhs.y),
992        }
993    }
994}
995
996impl Add<&Self> for U16Vec2 {
997    type Output = Self;
998    #[inline]
999    fn add(self, rhs: &Self) -> Self {
1000        self.add(*rhs)
1001    }
1002}
1003
1004impl Add<&U16Vec2> for &U16Vec2 {
1005    type Output = U16Vec2;
1006    #[inline]
1007    fn add(self, rhs: &U16Vec2) -> U16Vec2 {
1008        (*self).add(*rhs)
1009    }
1010}
1011
1012impl Add<U16Vec2> for &U16Vec2 {
1013    type Output = U16Vec2;
1014    #[inline]
1015    fn add(self, rhs: U16Vec2) -> U16Vec2 {
1016        (*self).add(rhs)
1017    }
1018}
1019
1020impl AddAssign for U16Vec2 {
1021    #[inline]
1022    fn add_assign(&mut self, rhs: Self) {
1023        self.x.add_assign(rhs.x);
1024        self.y.add_assign(rhs.y);
1025    }
1026}
1027
1028impl AddAssign<&Self> for U16Vec2 {
1029    #[inline]
1030    fn add_assign(&mut self, rhs: &Self) {
1031        self.add_assign(*rhs);
1032    }
1033}
1034
1035impl Add<u16> for U16Vec2 {
1036    type Output = Self;
1037    #[inline]
1038    fn add(self, rhs: u16) -> Self {
1039        Self {
1040            x: self.x.add(rhs),
1041            y: self.y.add(rhs),
1042        }
1043    }
1044}
1045
1046impl Add<&u16> for U16Vec2 {
1047    type Output = Self;
1048    #[inline]
1049    fn add(self, rhs: &u16) -> Self {
1050        self.add(*rhs)
1051    }
1052}
1053
1054impl Add<&u16> for &U16Vec2 {
1055    type Output = U16Vec2;
1056    #[inline]
1057    fn add(self, rhs: &u16) -> U16Vec2 {
1058        (*self).add(*rhs)
1059    }
1060}
1061
1062impl Add<u16> for &U16Vec2 {
1063    type Output = U16Vec2;
1064    #[inline]
1065    fn add(self, rhs: u16) -> U16Vec2 {
1066        (*self).add(rhs)
1067    }
1068}
1069
1070impl AddAssign<u16> for U16Vec2 {
1071    #[inline]
1072    fn add_assign(&mut self, rhs: u16) {
1073        self.x.add_assign(rhs);
1074        self.y.add_assign(rhs);
1075    }
1076}
1077
1078impl AddAssign<&u16> for U16Vec2 {
1079    #[inline]
1080    fn add_assign(&mut self, rhs: &u16) {
1081        self.add_assign(*rhs);
1082    }
1083}
1084
1085impl Add<U16Vec2> for u16 {
1086    type Output = U16Vec2;
1087    #[inline]
1088    fn add(self, rhs: U16Vec2) -> U16Vec2 {
1089        U16Vec2 {
1090            x: self.add(rhs.x),
1091            y: self.add(rhs.y),
1092        }
1093    }
1094}
1095
1096impl Add<&U16Vec2> for u16 {
1097    type Output = U16Vec2;
1098    #[inline]
1099    fn add(self, rhs: &U16Vec2) -> U16Vec2 {
1100        self.add(*rhs)
1101    }
1102}
1103
1104impl Add<&U16Vec2> for &u16 {
1105    type Output = U16Vec2;
1106    #[inline]
1107    fn add(self, rhs: &U16Vec2) -> U16Vec2 {
1108        (*self).add(*rhs)
1109    }
1110}
1111
1112impl Add<U16Vec2> for &u16 {
1113    type Output = U16Vec2;
1114    #[inline]
1115    fn add(self, rhs: U16Vec2) -> U16Vec2 {
1116        (*self).add(rhs)
1117    }
1118}
1119
1120impl Sub for U16Vec2 {
1121    type Output = Self;
1122    #[inline]
1123    fn sub(self, rhs: Self) -> Self {
1124        Self {
1125            x: self.x.sub(rhs.x),
1126            y: self.y.sub(rhs.y),
1127        }
1128    }
1129}
1130
1131impl Sub<&Self> for U16Vec2 {
1132    type Output = Self;
1133    #[inline]
1134    fn sub(self, rhs: &Self) -> Self {
1135        self.sub(*rhs)
1136    }
1137}
1138
1139impl Sub<&U16Vec2> for &U16Vec2 {
1140    type Output = U16Vec2;
1141    #[inline]
1142    fn sub(self, rhs: &U16Vec2) -> U16Vec2 {
1143        (*self).sub(*rhs)
1144    }
1145}
1146
1147impl Sub<U16Vec2> for &U16Vec2 {
1148    type Output = U16Vec2;
1149    #[inline]
1150    fn sub(self, rhs: U16Vec2) -> U16Vec2 {
1151        (*self).sub(rhs)
1152    }
1153}
1154
1155impl SubAssign for U16Vec2 {
1156    #[inline]
1157    fn sub_assign(&mut self, rhs: Self) {
1158        self.x.sub_assign(rhs.x);
1159        self.y.sub_assign(rhs.y);
1160    }
1161}
1162
1163impl SubAssign<&Self> for U16Vec2 {
1164    #[inline]
1165    fn sub_assign(&mut self, rhs: &Self) {
1166        self.sub_assign(*rhs);
1167    }
1168}
1169
1170impl Sub<u16> for U16Vec2 {
1171    type Output = Self;
1172    #[inline]
1173    fn sub(self, rhs: u16) -> Self {
1174        Self {
1175            x: self.x.sub(rhs),
1176            y: self.y.sub(rhs),
1177        }
1178    }
1179}
1180
1181impl Sub<&u16> for U16Vec2 {
1182    type Output = Self;
1183    #[inline]
1184    fn sub(self, rhs: &u16) -> Self {
1185        self.sub(*rhs)
1186    }
1187}
1188
1189impl Sub<&u16> for &U16Vec2 {
1190    type Output = U16Vec2;
1191    #[inline]
1192    fn sub(self, rhs: &u16) -> U16Vec2 {
1193        (*self).sub(*rhs)
1194    }
1195}
1196
1197impl Sub<u16> for &U16Vec2 {
1198    type Output = U16Vec2;
1199    #[inline]
1200    fn sub(self, rhs: u16) -> U16Vec2 {
1201        (*self).sub(rhs)
1202    }
1203}
1204
1205impl SubAssign<u16> for U16Vec2 {
1206    #[inline]
1207    fn sub_assign(&mut self, rhs: u16) {
1208        self.x.sub_assign(rhs);
1209        self.y.sub_assign(rhs);
1210    }
1211}
1212
1213impl SubAssign<&u16> for U16Vec2 {
1214    #[inline]
1215    fn sub_assign(&mut self, rhs: &u16) {
1216        self.sub_assign(*rhs);
1217    }
1218}
1219
1220impl Sub<U16Vec2> for u16 {
1221    type Output = U16Vec2;
1222    #[inline]
1223    fn sub(self, rhs: U16Vec2) -> U16Vec2 {
1224        U16Vec2 {
1225            x: self.sub(rhs.x),
1226            y: self.sub(rhs.y),
1227        }
1228    }
1229}
1230
1231impl Sub<&U16Vec2> for u16 {
1232    type Output = U16Vec2;
1233    #[inline]
1234    fn sub(self, rhs: &U16Vec2) -> U16Vec2 {
1235        self.sub(*rhs)
1236    }
1237}
1238
1239impl Sub<&U16Vec2> for &u16 {
1240    type Output = U16Vec2;
1241    #[inline]
1242    fn sub(self, rhs: &U16Vec2) -> U16Vec2 {
1243        (*self).sub(*rhs)
1244    }
1245}
1246
1247impl Sub<U16Vec2> for &u16 {
1248    type Output = U16Vec2;
1249    #[inline]
1250    fn sub(self, rhs: U16Vec2) -> U16Vec2 {
1251        (*self).sub(rhs)
1252    }
1253}
1254
1255impl Rem for U16Vec2 {
1256    type Output = Self;
1257    #[inline]
1258    fn rem(self, rhs: Self) -> Self {
1259        Self {
1260            x: self.x.rem(rhs.x),
1261            y: self.y.rem(rhs.y),
1262        }
1263    }
1264}
1265
1266impl Rem<&Self> for U16Vec2 {
1267    type Output = Self;
1268    #[inline]
1269    fn rem(self, rhs: &Self) -> Self {
1270        self.rem(*rhs)
1271    }
1272}
1273
1274impl Rem<&U16Vec2> for &U16Vec2 {
1275    type Output = U16Vec2;
1276    #[inline]
1277    fn rem(self, rhs: &U16Vec2) -> U16Vec2 {
1278        (*self).rem(*rhs)
1279    }
1280}
1281
1282impl Rem<U16Vec2> for &U16Vec2 {
1283    type Output = U16Vec2;
1284    #[inline]
1285    fn rem(self, rhs: U16Vec2) -> U16Vec2 {
1286        (*self).rem(rhs)
1287    }
1288}
1289
1290impl RemAssign for U16Vec2 {
1291    #[inline]
1292    fn rem_assign(&mut self, rhs: Self) {
1293        self.x.rem_assign(rhs.x);
1294        self.y.rem_assign(rhs.y);
1295    }
1296}
1297
1298impl RemAssign<&Self> for U16Vec2 {
1299    #[inline]
1300    fn rem_assign(&mut self, rhs: &Self) {
1301        self.rem_assign(*rhs);
1302    }
1303}
1304
1305impl Rem<u16> for U16Vec2 {
1306    type Output = Self;
1307    #[inline]
1308    fn rem(self, rhs: u16) -> Self {
1309        Self {
1310            x: self.x.rem(rhs),
1311            y: self.y.rem(rhs),
1312        }
1313    }
1314}
1315
1316impl Rem<&u16> for U16Vec2 {
1317    type Output = Self;
1318    #[inline]
1319    fn rem(self, rhs: &u16) -> Self {
1320        self.rem(*rhs)
1321    }
1322}
1323
1324impl Rem<&u16> for &U16Vec2 {
1325    type Output = U16Vec2;
1326    #[inline]
1327    fn rem(self, rhs: &u16) -> U16Vec2 {
1328        (*self).rem(*rhs)
1329    }
1330}
1331
1332impl Rem<u16> for &U16Vec2 {
1333    type Output = U16Vec2;
1334    #[inline]
1335    fn rem(self, rhs: u16) -> U16Vec2 {
1336        (*self).rem(rhs)
1337    }
1338}
1339
1340impl RemAssign<u16> for U16Vec2 {
1341    #[inline]
1342    fn rem_assign(&mut self, rhs: u16) {
1343        self.x.rem_assign(rhs);
1344        self.y.rem_assign(rhs);
1345    }
1346}
1347
1348impl RemAssign<&u16> for U16Vec2 {
1349    #[inline]
1350    fn rem_assign(&mut self, rhs: &u16) {
1351        self.rem_assign(*rhs);
1352    }
1353}
1354
1355impl Rem<U16Vec2> for u16 {
1356    type Output = U16Vec2;
1357    #[inline]
1358    fn rem(self, rhs: U16Vec2) -> U16Vec2 {
1359        U16Vec2 {
1360            x: self.rem(rhs.x),
1361            y: self.rem(rhs.y),
1362        }
1363    }
1364}
1365
1366impl Rem<&U16Vec2> for u16 {
1367    type Output = U16Vec2;
1368    #[inline]
1369    fn rem(self, rhs: &U16Vec2) -> U16Vec2 {
1370        self.rem(*rhs)
1371    }
1372}
1373
1374impl Rem<&U16Vec2> for &u16 {
1375    type Output = U16Vec2;
1376    #[inline]
1377    fn rem(self, rhs: &U16Vec2) -> U16Vec2 {
1378        (*self).rem(*rhs)
1379    }
1380}
1381
1382impl Rem<U16Vec2> for &u16 {
1383    type Output = U16Vec2;
1384    #[inline]
1385    fn rem(self, rhs: U16Vec2) -> U16Vec2 {
1386        (*self).rem(rhs)
1387    }
1388}
1389
1390impl AsRef<[u16; 2]> for U16Vec2 {
1391    #[inline]
1392    fn as_ref(&self) -> &[u16; 2] {
1393        unsafe { &*(self as *const Self as *const [u16; 2]) }
1394    }
1395}
1396
1397impl AsMut<[u16; 2]> for U16Vec2 {
1398    #[inline]
1399    fn as_mut(&mut self) -> &mut [u16; 2] {
1400        unsafe { &mut *(self as *mut Self as *mut [u16; 2]) }
1401    }
1402}
1403
1404impl Sum for U16Vec2 {
1405    #[inline]
1406    fn sum<I>(iter: I) -> Self
1407    where
1408        I: Iterator<Item = Self>,
1409    {
1410        iter.fold(Self::ZERO, Self::add)
1411    }
1412}
1413
1414impl<'a> Sum<&'a Self> for U16Vec2 {
1415    #[inline]
1416    fn sum<I>(iter: I) -> Self
1417    where
1418        I: Iterator<Item = &'a Self>,
1419    {
1420        iter.fold(Self::ZERO, |a, &b| Self::add(a, b))
1421    }
1422}
1423
1424impl Product for U16Vec2 {
1425    #[inline]
1426    fn product<I>(iter: I) -> Self
1427    where
1428        I: Iterator<Item = Self>,
1429    {
1430        iter.fold(Self::ONE, Self::mul)
1431    }
1432}
1433
1434impl<'a> Product<&'a Self> for U16Vec2 {
1435    #[inline]
1436    fn product<I>(iter: I) -> Self
1437    where
1438        I: Iterator<Item = &'a Self>,
1439    {
1440        iter.fold(Self::ONE, |a, &b| Self::mul(a, b))
1441    }
1442}
1443
1444impl Not for U16Vec2 {
1445    type Output = Self;
1446    #[inline]
1447    fn not(self) -> Self {
1448        Self {
1449            x: self.x.not(),
1450            y: self.y.not(),
1451        }
1452    }
1453}
1454
1455impl Not for &U16Vec2 {
1456    type Output = U16Vec2;
1457    #[inline]
1458    fn not(self) -> U16Vec2 {
1459        (*self).not()
1460    }
1461}
1462
1463impl BitAnd for U16Vec2 {
1464    type Output = Self;
1465    #[inline]
1466    fn bitand(self, rhs: Self) -> Self::Output {
1467        Self {
1468            x: self.x.bitand(rhs.x),
1469            y: self.y.bitand(rhs.y),
1470        }
1471    }
1472}
1473
1474impl BitAnd<&Self> for U16Vec2 {
1475    type Output = Self;
1476    #[inline]
1477    fn bitand(self, rhs: &Self) -> Self {
1478        self.bitand(*rhs)
1479    }
1480}
1481
1482impl BitAnd<&U16Vec2> for &U16Vec2 {
1483    type Output = U16Vec2;
1484    #[inline]
1485    fn bitand(self, rhs: &U16Vec2) -> U16Vec2 {
1486        (*self).bitand(*rhs)
1487    }
1488}
1489
1490impl BitAnd<U16Vec2> for &U16Vec2 {
1491    type Output = U16Vec2;
1492    #[inline]
1493    fn bitand(self, rhs: U16Vec2) -> U16Vec2 {
1494        (*self).bitand(rhs)
1495    }
1496}
1497
1498impl BitAndAssign for U16Vec2 {
1499    #[inline]
1500    fn bitand_assign(&mut self, rhs: Self) {
1501        *self = self.bitand(rhs);
1502    }
1503}
1504
1505impl BitAndAssign<&Self> for U16Vec2 {
1506    #[inline]
1507    fn bitand_assign(&mut self, rhs: &Self) {
1508        self.bitand_assign(*rhs);
1509    }
1510}
1511
1512impl BitOr for U16Vec2 {
1513    type Output = Self;
1514    #[inline]
1515    fn bitor(self, rhs: Self) -> Self::Output {
1516        Self {
1517            x: self.x.bitor(rhs.x),
1518            y: self.y.bitor(rhs.y),
1519        }
1520    }
1521}
1522
1523impl BitOr<&Self> for U16Vec2 {
1524    type Output = Self;
1525    #[inline]
1526    fn bitor(self, rhs: &Self) -> Self {
1527        self.bitor(*rhs)
1528    }
1529}
1530
1531impl BitOr<&U16Vec2> for &U16Vec2 {
1532    type Output = U16Vec2;
1533    #[inline]
1534    fn bitor(self, rhs: &U16Vec2) -> U16Vec2 {
1535        (*self).bitor(*rhs)
1536    }
1537}
1538
1539impl BitOr<U16Vec2> for &U16Vec2 {
1540    type Output = U16Vec2;
1541    #[inline]
1542    fn bitor(self, rhs: U16Vec2) -> U16Vec2 {
1543        (*self).bitor(rhs)
1544    }
1545}
1546
1547impl BitOrAssign for U16Vec2 {
1548    #[inline]
1549    fn bitor_assign(&mut self, rhs: Self) {
1550        *self = self.bitor(rhs);
1551    }
1552}
1553
1554impl BitOrAssign<&Self> for U16Vec2 {
1555    #[inline]
1556    fn bitor_assign(&mut self, rhs: &Self) {
1557        self.bitor_assign(*rhs);
1558    }
1559}
1560
1561impl BitXor for U16Vec2 {
1562    type Output = Self;
1563    #[inline]
1564    fn bitxor(self, rhs: Self) -> Self::Output {
1565        Self {
1566            x: self.x.bitxor(rhs.x),
1567            y: self.y.bitxor(rhs.y),
1568        }
1569    }
1570}
1571
1572impl BitXor<&Self> for U16Vec2 {
1573    type Output = Self;
1574    #[inline]
1575    fn bitxor(self, rhs: &Self) -> Self {
1576        self.bitxor(*rhs)
1577    }
1578}
1579
1580impl BitXor<&U16Vec2> for &U16Vec2 {
1581    type Output = U16Vec2;
1582    #[inline]
1583    fn bitxor(self, rhs: &U16Vec2) -> U16Vec2 {
1584        (*self).bitxor(*rhs)
1585    }
1586}
1587
1588impl BitXor<U16Vec2> for &U16Vec2 {
1589    type Output = U16Vec2;
1590    #[inline]
1591    fn bitxor(self, rhs: U16Vec2) -> U16Vec2 {
1592        (*self).bitxor(rhs)
1593    }
1594}
1595
1596impl BitXorAssign for U16Vec2 {
1597    #[inline]
1598    fn bitxor_assign(&mut self, rhs: Self) {
1599        *self = self.bitxor(rhs);
1600    }
1601}
1602
1603impl BitXorAssign<&Self> for U16Vec2 {
1604    #[inline]
1605    fn bitxor_assign(&mut self, rhs: &Self) {
1606        self.bitxor_assign(*rhs);
1607    }
1608}
1609
1610impl BitAnd<u16> for U16Vec2 {
1611    type Output = Self;
1612    #[inline]
1613    fn bitand(self, rhs: u16) -> Self::Output {
1614        Self {
1615            x: self.x.bitand(rhs),
1616            y: self.y.bitand(rhs),
1617        }
1618    }
1619}
1620
1621impl BitAnd<&u16> for U16Vec2 {
1622    type Output = Self;
1623    #[inline]
1624    fn bitand(self, rhs: &u16) -> Self {
1625        self.bitand(*rhs)
1626    }
1627}
1628
1629impl BitAnd<&u16> for &U16Vec2 {
1630    type Output = U16Vec2;
1631    #[inline]
1632    fn bitand(self, rhs: &u16) -> U16Vec2 {
1633        (*self).bitand(*rhs)
1634    }
1635}
1636
1637impl BitAnd<u16> for &U16Vec2 {
1638    type Output = U16Vec2;
1639    #[inline]
1640    fn bitand(self, rhs: u16) -> U16Vec2 {
1641        (*self).bitand(rhs)
1642    }
1643}
1644
1645impl BitAndAssign<u16> for U16Vec2 {
1646    #[inline]
1647    fn bitand_assign(&mut self, rhs: u16) {
1648        *self = self.bitand(rhs);
1649    }
1650}
1651
1652impl BitAndAssign<&u16> for U16Vec2 {
1653    #[inline]
1654    fn bitand_assign(&mut self, rhs: &u16) {
1655        self.bitand_assign(*rhs);
1656    }
1657}
1658
1659impl BitOr<u16> for U16Vec2 {
1660    type Output = Self;
1661    #[inline]
1662    fn bitor(self, rhs: u16) -> Self::Output {
1663        Self {
1664            x: self.x.bitor(rhs),
1665            y: self.y.bitor(rhs),
1666        }
1667    }
1668}
1669
1670impl BitOr<&u16> for U16Vec2 {
1671    type Output = Self;
1672    #[inline]
1673    fn bitor(self, rhs: &u16) -> Self {
1674        self.bitor(*rhs)
1675    }
1676}
1677
1678impl BitOr<&u16> for &U16Vec2 {
1679    type Output = U16Vec2;
1680    #[inline]
1681    fn bitor(self, rhs: &u16) -> U16Vec2 {
1682        (*self).bitor(*rhs)
1683    }
1684}
1685
1686impl BitOr<u16> for &U16Vec2 {
1687    type Output = U16Vec2;
1688    #[inline]
1689    fn bitor(self, rhs: u16) -> U16Vec2 {
1690        (*self).bitor(rhs)
1691    }
1692}
1693
1694impl BitOrAssign<u16> for U16Vec2 {
1695    #[inline]
1696    fn bitor_assign(&mut self, rhs: u16) {
1697        *self = self.bitor(rhs);
1698    }
1699}
1700
1701impl BitOrAssign<&u16> for U16Vec2 {
1702    #[inline]
1703    fn bitor_assign(&mut self, rhs: &u16) {
1704        self.bitor_assign(*rhs);
1705    }
1706}
1707
1708impl BitXor<u16> for U16Vec2 {
1709    type Output = Self;
1710    #[inline]
1711    fn bitxor(self, rhs: u16) -> Self::Output {
1712        Self {
1713            x: self.x.bitxor(rhs),
1714            y: self.y.bitxor(rhs),
1715        }
1716    }
1717}
1718
1719impl BitXor<&u16> for U16Vec2 {
1720    type Output = Self;
1721    #[inline]
1722    fn bitxor(self, rhs: &u16) -> Self {
1723        self.bitxor(*rhs)
1724    }
1725}
1726
1727impl BitXor<&u16> for &U16Vec2 {
1728    type Output = U16Vec2;
1729    #[inline]
1730    fn bitxor(self, rhs: &u16) -> U16Vec2 {
1731        (*self).bitxor(*rhs)
1732    }
1733}
1734
1735impl BitXor<u16> for &U16Vec2 {
1736    type Output = U16Vec2;
1737    #[inline]
1738    fn bitxor(self, rhs: u16) -> U16Vec2 {
1739        (*self).bitxor(rhs)
1740    }
1741}
1742
1743impl BitXorAssign<u16> for U16Vec2 {
1744    #[inline]
1745    fn bitxor_assign(&mut self, rhs: u16) {
1746        *self = self.bitxor(rhs);
1747    }
1748}
1749
1750impl BitXorAssign<&u16> for U16Vec2 {
1751    #[inline]
1752    fn bitxor_assign(&mut self, rhs: &u16) {
1753        self.bitxor_assign(*rhs);
1754    }
1755}
1756
1757impl Shl<i8> for U16Vec2 {
1758    type Output = Self;
1759    #[inline]
1760    fn shl(self, rhs: i8) -> Self::Output {
1761        Self {
1762            x: self.x.shl(rhs),
1763            y: self.y.shl(rhs),
1764        }
1765    }
1766}
1767
1768impl Shl<&i8> for U16Vec2 {
1769    type Output = Self;
1770    #[inline]
1771    fn shl(self, rhs: &i8) -> Self {
1772        self.shl(*rhs)
1773    }
1774}
1775
1776impl Shl<&i8> for &U16Vec2 {
1777    type Output = U16Vec2;
1778    #[inline]
1779    fn shl(self, rhs: &i8) -> U16Vec2 {
1780        (*self).shl(*rhs)
1781    }
1782}
1783
1784impl Shl<i8> for &U16Vec2 {
1785    type Output = U16Vec2;
1786    #[inline]
1787    fn shl(self, rhs: i8) -> U16Vec2 {
1788        (*self).shl(rhs)
1789    }
1790}
1791
1792impl ShlAssign<i8> for U16Vec2 {
1793    #[inline]
1794    fn shl_assign(&mut self, rhs: i8) {
1795        *self = self.shl(rhs);
1796    }
1797}
1798
1799impl ShlAssign<&i8> for U16Vec2 {
1800    #[inline]
1801    fn shl_assign(&mut self, rhs: &i8) {
1802        self.shl_assign(*rhs);
1803    }
1804}
1805
1806impl Shr<i8> for U16Vec2 {
1807    type Output = Self;
1808    #[inline]
1809    fn shr(self, rhs: i8) -> Self::Output {
1810        Self {
1811            x: self.x.shr(rhs),
1812            y: self.y.shr(rhs),
1813        }
1814    }
1815}
1816
1817impl Shr<&i8> for U16Vec2 {
1818    type Output = Self;
1819    #[inline]
1820    fn shr(self, rhs: &i8) -> Self {
1821        self.shr(*rhs)
1822    }
1823}
1824
1825impl Shr<&i8> for &U16Vec2 {
1826    type Output = U16Vec2;
1827    #[inline]
1828    fn shr(self, rhs: &i8) -> U16Vec2 {
1829        (*self).shr(*rhs)
1830    }
1831}
1832
1833impl Shr<i8> for &U16Vec2 {
1834    type Output = U16Vec2;
1835    #[inline]
1836    fn shr(self, rhs: i8) -> U16Vec2 {
1837        (*self).shr(rhs)
1838    }
1839}
1840
1841impl ShrAssign<i8> for U16Vec2 {
1842    #[inline]
1843    fn shr_assign(&mut self, rhs: i8) {
1844        *self = self.shr(rhs);
1845    }
1846}
1847
1848impl ShrAssign<&i8> for U16Vec2 {
1849    #[inline]
1850    fn shr_assign(&mut self, rhs: &i8) {
1851        self.shr_assign(*rhs);
1852    }
1853}
1854
1855impl Shl<i16> for U16Vec2 {
1856    type Output = Self;
1857    #[inline]
1858    fn shl(self, rhs: i16) -> Self::Output {
1859        Self {
1860            x: self.x.shl(rhs),
1861            y: self.y.shl(rhs),
1862        }
1863    }
1864}
1865
1866impl Shl<&i16> for U16Vec2 {
1867    type Output = Self;
1868    #[inline]
1869    fn shl(self, rhs: &i16) -> Self {
1870        self.shl(*rhs)
1871    }
1872}
1873
1874impl Shl<&i16> for &U16Vec2 {
1875    type Output = U16Vec2;
1876    #[inline]
1877    fn shl(self, rhs: &i16) -> U16Vec2 {
1878        (*self).shl(*rhs)
1879    }
1880}
1881
1882impl Shl<i16> for &U16Vec2 {
1883    type Output = U16Vec2;
1884    #[inline]
1885    fn shl(self, rhs: i16) -> U16Vec2 {
1886        (*self).shl(rhs)
1887    }
1888}
1889
1890impl ShlAssign<i16> for U16Vec2 {
1891    #[inline]
1892    fn shl_assign(&mut self, rhs: i16) {
1893        *self = self.shl(rhs);
1894    }
1895}
1896
1897impl ShlAssign<&i16> for U16Vec2 {
1898    #[inline]
1899    fn shl_assign(&mut self, rhs: &i16) {
1900        self.shl_assign(*rhs);
1901    }
1902}
1903
1904impl Shr<i16> for U16Vec2 {
1905    type Output = Self;
1906    #[inline]
1907    fn shr(self, rhs: i16) -> Self::Output {
1908        Self {
1909            x: self.x.shr(rhs),
1910            y: self.y.shr(rhs),
1911        }
1912    }
1913}
1914
1915impl Shr<&i16> for U16Vec2 {
1916    type Output = Self;
1917    #[inline]
1918    fn shr(self, rhs: &i16) -> Self {
1919        self.shr(*rhs)
1920    }
1921}
1922
1923impl Shr<&i16> for &U16Vec2 {
1924    type Output = U16Vec2;
1925    #[inline]
1926    fn shr(self, rhs: &i16) -> U16Vec2 {
1927        (*self).shr(*rhs)
1928    }
1929}
1930
1931impl Shr<i16> for &U16Vec2 {
1932    type Output = U16Vec2;
1933    #[inline]
1934    fn shr(self, rhs: i16) -> U16Vec2 {
1935        (*self).shr(rhs)
1936    }
1937}
1938
1939impl ShrAssign<i16> for U16Vec2 {
1940    #[inline]
1941    fn shr_assign(&mut self, rhs: i16) {
1942        *self = self.shr(rhs);
1943    }
1944}
1945
1946impl ShrAssign<&i16> for U16Vec2 {
1947    #[inline]
1948    fn shr_assign(&mut self, rhs: &i16) {
1949        self.shr_assign(*rhs);
1950    }
1951}
1952
1953impl Shl<i32> for U16Vec2 {
1954    type Output = Self;
1955    #[inline]
1956    fn shl(self, rhs: i32) -> Self::Output {
1957        Self {
1958            x: self.x.shl(rhs),
1959            y: self.y.shl(rhs),
1960        }
1961    }
1962}
1963
1964impl Shl<&i32> for U16Vec2 {
1965    type Output = Self;
1966    #[inline]
1967    fn shl(self, rhs: &i32) -> Self {
1968        self.shl(*rhs)
1969    }
1970}
1971
1972impl Shl<&i32> for &U16Vec2 {
1973    type Output = U16Vec2;
1974    #[inline]
1975    fn shl(self, rhs: &i32) -> U16Vec2 {
1976        (*self).shl(*rhs)
1977    }
1978}
1979
1980impl Shl<i32> for &U16Vec2 {
1981    type Output = U16Vec2;
1982    #[inline]
1983    fn shl(self, rhs: i32) -> U16Vec2 {
1984        (*self).shl(rhs)
1985    }
1986}
1987
1988impl ShlAssign<i32> for U16Vec2 {
1989    #[inline]
1990    fn shl_assign(&mut self, rhs: i32) {
1991        *self = self.shl(rhs);
1992    }
1993}
1994
1995impl ShlAssign<&i32> for U16Vec2 {
1996    #[inline]
1997    fn shl_assign(&mut self, rhs: &i32) {
1998        self.shl_assign(*rhs);
1999    }
2000}
2001
2002impl Shr<i32> for U16Vec2 {
2003    type Output = Self;
2004    #[inline]
2005    fn shr(self, rhs: i32) -> Self::Output {
2006        Self {
2007            x: self.x.shr(rhs),
2008            y: self.y.shr(rhs),
2009        }
2010    }
2011}
2012
2013impl Shr<&i32> for U16Vec2 {
2014    type Output = Self;
2015    #[inline]
2016    fn shr(self, rhs: &i32) -> Self {
2017        self.shr(*rhs)
2018    }
2019}
2020
2021impl Shr<&i32> for &U16Vec2 {
2022    type Output = U16Vec2;
2023    #[inline]
2024    fn shr(self, rhs: &i32) -> U16Vec2 {
2025        (*self).shr(*rhs)
2026    }
2027}
2028
2029impl Shr<i32> for &U16Vec2 {
2030    type Output = U16Vec2;
2031    #[inline]
2032    fn shr(self, rhs: i32) -> U16Vec2 {
2033        (*self).shr(rhs)
2034    }
2035}
2036
2037impl ShrAssign<i32> for U16Vec2 {
2038    #[inline]
2039    fn shr_assign(&mut self, rhs: i32) {
2040        *self = self.shr(rhs);
2041    }
2042}
2043
2044impl ShrAssign<&i32> for U16Vec2 {
2045    #[inline]
2046    fn shr_assign(&mut self, rhs: &i32) {
2047        self.shr_assign(*rhs);
2048    }
2049}
2050
2051impl Shl<i64> for U16Vec2 {
2052    type Output = Self;
2053    #[inline]
2054    fn shl(self, rhs: i64) -> Self::Output {
2055        Self {
2056            x: self.x.shl(rhs),
2057            y: self.y.shl(rhs),
2058        }
2059    }
2060}
2061
2062impl Shl<&i64> for U16Vec2 {
2063    type Output = Self;
2064    #[inline]
2065    fn shl(self, rhs: &i64) -> Self {
2066        self.shl(*rhs)
2067    }
2068}
2069
2070impl Shl<&i64> for &U16Vec2 {
2071    type Output = U16Vec2;
2072    #[inline]
2073    fn shl(self, rhs: &i64) -> U16Vec2 {
2074        (*self).shl(*rhs)
2075    }
2076}
2077
2078impl Shl<i64> for &U16Vec2 {
2079    type Output = U16Vec2;
2080    #[inline]
2081    fn shl(self, rhs: i64) -> U16Vec2 {
2082        (*self).shl(rhs)
2083    }
2084}
2085
2086impl ShlAssign<i64> for U16Vec2 {
2087    #[inline]
2088    fn shl_assign(&mut self, rhs: i64) {
2089        *self = self.shl(rhs);
2090    }
2091}
2092
2093impl ShlAssign<&i64> for U16Vec2 {
2094    #[inline]
2095    fn shl_assign(&mut self, rhs: &i64) {
2096        self.shl_assign(*rhs);
2097    }
2098}
2099
2100impl Shr<i64> for U16Vec2 {
2101    type Output = Self;
2102    #[inline]
2103    fn shr(self, rhs: i64) -> Self::Output {
2104        Self {
2105            x: self.x.shr(rhs),
2106            y: self.y.shr(rhs),
2107        }
2108    }
2109}
2110
2111impl Shr<&i64> for U16Vec2 {
2112    type Output = Self;
2113    #[inline]
2114    fn shr(self, rhs: &i64) -> Self {
2115        self.shr(*rhs)
2116    }
2117}
2118
2119impl Shr<&i64> for &U16Vec2 {
2120    type Output = U16Vec2;
2121    #[inline]
2122    fn shr(self, rhs: &i64) -> U16Vec2 {
2123        (*self).shr(*rhs)
2124    }
2125}
2126
2127impl Shr<i64> for &U16Vec2 {
2128    type Output = U16Vec2;
2129    #[inline]
2130    fn shr(self, rhs: i64) -> U16Vec2 {
2131        (*self).shr(rhs)
2132    }
2133}
2134
2135impl ShrAssign<i64> for U16Vec2 {
2136    #[inline]
2137    fn shr_assign(&mut self, rhs: i64) {
2138        *self = self.shr(rhs);
2139    }
2140}
2141
2142impl ShrAssign<&i64> for U16Vec2 {
2143    #[inline]
2144    fn shr_assign(&mut self, rhs: &i64) {
2145        self.shr_assign(*rhs);
2146    }
2147}
2148
2149impl Shl<u8> for U16Vec2 {
2150    type Output = Self;
2151    #[inline]
2152    fn shl(self, rhs: u8) -> Self::Output {
2153        Self {
2154            x: self.x.shl(rhs),
2155            y: self.y.shl(rhs),
2156        }
2157    }
2158}
2159
2160impl Shl<&u8> for U16Vec2 {
2161    type Output = Self;
2162    #[inline]
2163    fn shl(self, rhs: &u8) -> Self {
2164        self.shl(*rhs)
2165    }
2166}
2167
2168impl Shl<&u8> for &U16Vec2 {
2169    type Output = U16Vec2;
2170    #[inline]
2171    fn shl(self, rhs: &u8) -> U16Vec2 {
2172        (*self).shl(*rhs)
2173    }
2174}
2175
2176impl Shl<u8> for &U16Vec2 {
2177    type Output = U16Vec2;
2178    #[inline]
2179    fn shl(self, rhs: u8) -> U16Vec2 {
2180        (*self).shl(rhs)
2181    }
2182}
2183
2184impl ShlAssign<u8> for U16Vec2 {
2185    #[inline]
2186    fn shl_assign(&mut self, rhs: u8) {
2187        *self = self.shl(rhs);
2188    }
2189}
2190
2191impl ShlAssign<&u8> for U16Vec2 {
2192    #[inline]
2193    fn shl_assign(&mut self, rhs: &u8) {
2194        self.shl_assign(*rhs);
2195    }
2196}
2197
2198impl Shr<u8> for U16Vec2 {
2199    type Output = Self;
2200    #[inline]
2201    fn shr(self, rhs: u8) -> Self::Output {
2202        Self {
2203            x: self.x.shr(rhs),
2204            y: self.y.shr(rhs),
2205        }
2206    }
2207}
2208
2209impl Shr<&u8> for U16Vec2 {
2210    type Output = Self;
2211    #[inline]
2212    fn shr(self, rhs: &u8) -> Self {
2213        self.shr(*rhs)
2214    }
2215}
2216
2217impl Shr<&u8> for &U16Vec2 {
2218    type Output = U16Vec2;
2219    #[inline]
2220    fn shr(self, rhs: &u8) -> U16Vec2 {
2221        (*self).shr(*rhs)
2222    }
2223}
2224
2225impl Shr<u8> for &U16Vec2 {
2226    type Output = U16Vec2;
2227    #[inline]
2228    fn shr(self, rhs: u8) -> U16Vec2 {
2229        (*self).shr(rhs)
2230    }
2231}
2232
2233impl ShrAssign<u8> for U16Vec2 {
2234    #[inline]
2235    fn shr_assign(&mut self, rhs: u8) {
2236        *self = self.shr(rhs);
2237    }
2238}
2239
2240impl ShrAssign<&u8> for U16Vec2 {
2241    #[inline]
2242    fn shr_assign(&mut self, rhs: &u8) {
2243        self.shr_assign(*rhs);
2244    }
2245}
2246
2247impl Shl<u16> for U16Vec2 {
2248    type Output = Self;
2249    #[inline]
2250    fn shl(self, rhs: u16) -> Self::Output {
2251        Self {
2252            x: self.x.shl(rhs),
2253            y: self.y.shl(rhs),
2254        }
2255    }
2256}
2257
2258impl Shl<&u16> for U16Vec2 {
2259    type Output = Self;
2260    #[inline]
2261    fn shl(self, rhs: &u16) -> Self {
2262        self.shl(*rhs)
2263    }
2264}
2265
2266impl Shl<&u16> for &U16Vec2 {
2267    type Output = U16Vec2;
2268    #[inline]
2269    fn shl(self, rhs: &u16) -> U16Vec2 {
2270        (*self).shl(*rhs)
2271    }
2272}
2273
2274impl Shl<u16> for &U16Vec2 {
2275    type Output = U16Vec2;
2276    #[inline]
2277    fn shl(self, rhs: u16) -> U16Vec2 {
2278        (*self).shl(rhs)
2279    }
2280}
2281
2282impl ShlAssign<u16> for U16Vec2 {
2283    #[inline]
2284    fn shl_assign(&mut self, rhs: u16) {
2285        *self = self.shl(rhs);
2286    }
2287}
2288
2289impl ShlAssign<&u16> for U16Vec2 {
2290    #[inline]
2291    fn shl_assign(&mut self, rhs: &u16) {
2292        self.shl_assign(*rhs);
2293    }
2294}
2295
2296impl Shr<u16> for U16Vec2 {
2297    type Output = Self;
2298    #[inline]
2299    fn shr(self, rhs: u16) -> Self::Output {
2300        Self {
2301            x: self.x.shr(rhs),
2302            y: self.y.shr(rhs),
2303        }
2304    }
2305}
2306
2307impl Shr<&u16> for U16Vec2 {
2308    type Output = Self;
2309    #[inline]
2310    fn shr(self, rhs: &u16) -> Self {
2311        self.shr(*rhs)
2312    }
2313}
2314
2315impl Shr<&u16> for &U16Vec2 {
2316    type Output = U16Vec2;
2317    #[inline]
2318    fn shr(self, rhs: &u16) -> U16Vec2 {
2319        (*self).shr(*rhs)
2320    }
2321}
2322
2323impl Shr<u16> for &U16Vec2 {
2324    type Output = U16Vec2;
2325    #[inline]
2326    fn shr(self, rhs: u16) -> U16Vec2 {
2327        (*self).shr(rhs)
2328    }
2329}
2330
2331impl ShrAssign<u16> for U16Vec2 {
2332    #[inline]
2333    fn shr_assign(&mut self, rhs: u16) {
2334        *self = self.shr(rhs);
2335    }
2336}
2337
2338impl ShrAssign<&u16> for U16Vec2 {
2339    #[inline]
2340    fn shr_assign(&mut self, rhs: &u16) {
2341        self.shr_assign(*rhs);
2342    }
2343}
2344
2345impl Shl<u32> for U16Vec2 {
2346    type Output = Self;
2347    #[inline]
2348    fn shl(self, rhs: u32) -> Self::Output {
2349        Self {
2350            x: self.x.shl(rhs),
2351            y: self.y.shl(rhs),
2352        }
2353    }
2354}
2355
2356impl Shl<&u32> for U16Vec2 {
2357    type Output = Self;
2358    #[inline]
2359    fn shl(self, rhs: &u32) -> Self {
2360        self.shl(*rhs)
2361    }
2362}
2363
2364impl Shl<&u32> for &U16Vec2 {
2365    type Output = U16Vec2;
2366    #[inline]
2367    fn shl(self, rhs: &u32) -> U16Vec2 {
2368        (*self).shl(*rhs)
2369    }
2370}
2371
2372impl Shl<u32> for &U16Vec2 {
2373    type Output = U16Vec2;
2374    #[inline]
2375    fn shl(self, rhs: u32) -> U16Vec2 {
2376        (*self).shl(rhs)
2377    }
2378}
2379
2380impl ShlAssign<u32> for U16Vec2 {
2381    #[inline]
2382    fn shl_assign(&mut self, rhs: u32) {
2383        *self = self.shl(rhs);
2384    }
2385}
2386
2387impl ShlAssign<&u32> for U16Vec2 {
2388    #[inline]
2389    fn shl_assign(&mut self, rhs: &u32) {
2390        self.shl_assign(*rhs);
2391    }
2392}
2393
2394impl Shr<u32> for U16Vec2 {
2395    type Output = Self;
2396    #[inline]
2397    fn shr(self, rhs: u32) -> Self::Output {
2398        Self {
2399            x: self.x.shr(rhs),
2400            y: self.y.shr(rhs),
2401        }
2402    }
2403}
2404
2405impl Shr<&u32> for U16Vec2 {
2406    type Output = Self;
2407    #[inline]
2408    fn shr(self, rhs: &u32) -> Self {
2409        self.shr(*rhs)
2410    }
2411}
2412
2413impl Shr<&u32> for &U16Vec2 {
2414    type Output = U16Vec2;
2415    #[inline]
2416    fn shr(self, rhs: &u32) -> U16Vec2 {
2417        (*self).shr(*rhs)
2418    }
2419}
2420
2421impl Shr<u32> for &U16Vec2 {
2422    type Output = U16Vec2;
2423    #[inline]
2424    fn shr(self, rhs: u32) -> U16Vec2 {
2425        (*self).shr(rhs)
2426    }
2427}
2428
2429impl ShrAssign<u32> for U16Vec2 {
2430    #[inline]
2431    fn shr_assign(&mut self, rhs: u32) {
2432        *self = self.shr(rhs);
2433    }
2434}
2435
2436impl ShrAssign<&u32> for U16Vec2 {
2437    #[inline]
2438    fn shr_assign(&mut self, rhs: &u32) {
2439        self.shr_assign(*rhs);
2440    }
2441}
2442
2443impl Shl<u64> for U16Vec2 {
2444    type Output = Self;
2445    #[inline]
2446    fn shl(self, rhs: u64) -> Self::Output {
2447        Self {
2448            x: self.x.shl(rhs),
2449            y: self.y.shl(rhs),
2450        }
2451    }
2452}
2453
2454impl Shl<&u64> for U16Vec2 {
2455    type Output = Self;
2456    #[inline]
2457    fn shl(self, rhs: &u64) -> Self {
2458        self.shl(*rhs)
2459    }
2460}
2461
2462impl Shl<&u64> for &U16Vec2 {
2463    type Output = U16Vec2;
2464    #[inline]
2465    fn shl(self, rhs: &u64) -> U16Vec2 {
2466        (*self).shl(*rhs)
2467    }
2468}
2469
2470impl Shl<u64> for &U16Vec2 {
2471    type Output = U16Vec2;
2472    #[inline]
2473    fn shl(self, rhs: u64) -> U16Vec2 {
2474        (*self).shl(rhs)
2475    }
2476}
2477
2478impl ShlAssign<u64> for U16Vec2 {
2479    #[inline]
2480    fn shl_assign(&mut self, rhs: u64) {
2481        *self = self.shl(rhs);
2482    }
2483}
2484
2485impl ShlAssign<&u64> for U16Vec2 {
2486    #[inline]
2487    fn shl_assign(&mut self, rhs: &u64) {
2488        self.shl_assign(*rhs);
2489    }
2490}
2491
2492impl Shr<u64> for U16Vec2 {
2493    type Output = Self;
2494    #[inline]
2495    fn shr(self, rhs: u64) -> Self::Output {
2496        Self {
2497            x: self.x.shr(rhs),
2498            y: self.y.shr(rhs),
2499        }
2500    }
2501}
2502
2503impl Shr<&u64> for U16Vec2 {
2504    type Output = Self;
2505    #[inline]
2506    fn shr(self, rhs: &u64) -> Self {
2507        self.shr(*rhs)
2508    }
2509}
2510
2511impl Shr<&u64> for &U16Vec2 {
2512    type Output = U16Vec2;
2513    #[inline]
2514    fn shr(self, rhs: &u64) -> U16Vec2 {
2515        (*self).shr(*rhs)
2516    }
2517}
2518
2519impl Shr<u64> for &U16Vec2 {
2520    type Output = U16Vec2;
2521    #[inline]
2522    fn shr(self, rhs: u64) -> U16Vec2 {
2523        (*self).shr(rhs)
2524    }
2525}
2526
2527impl ShrAssign<u64> for U16Vec2 {
2528    #[inline]
2529    fn shr_assign(&mut self, rhs: u64) {
2530        *self = self.shr(rhs);
2531    }
2532}
2533
2534impl ShrAssign<&u64> for U16Vec2 {
2535    #[inline]
2536    fn shr_assign(&mut self, rhs: &u64) {
2537        self.shr_assign(*rhs);
2538    }
2539}
2540
2541#[cfg(feature = "i32")]
2542impl Shl<IVec2> for U16Vec2 {
2543    type Output = Self;
2544    #[inline]
2545    fn shl(self, rhs: IVec2) -> Self {
2546        Self {
2547            x: self.x.shl(rhs.x),
2548            y: self.y.shl(rhs.y),
2549        }
2550    }
2551}
2552
2553#[cfg(feature = "i32")]
2554impl Shl<&IVec2> for U16Vec2 {
2555    type Output = Self;
2556    #[inline]
2557    fn shl(self, rhs: &IVec2) -> Self {
2558        self.shl(*rhs)
2559    }
2560}
2561
2562#[cfg(feature = "i32")]
2563impl Shl<&IVec2> for &U16Vec2 {
2564    type Output = U16Vec2;
2565    #[inline]
2566    fn shl(self, rhs: &IVec2) -> U16Vec2 {
2567        (*self).shl(*rhs)
2568    }
2569}
2570
2571#[cfg(feature = "i32")]
2572impl Shl<IVec2> for &U16Vec2 {
2573    type Output = U16Vec2;
2574    #[inline]
2575    fn shl(self, rhs: IVec2) -> U16Vec2 {
2576        (*self).shl(rhs)
2577    }
2578}
2579
2580#[cfg(feature = "i32")]
2581impl Shr<IVec2> for U16Vec2 {
2582    type Output = Self;
2583    #[inline]
2584    fn shr(self, rhs: IVec2) -> Self {
2585        Self {
2586            x: self.x.shr(rhs.x),
2587            y: self.y.shr(rhs.y),
2588        }
2589    }
2590}
2591
2592#[cfg(feature = "i32")]
2593impl Shr<&IVec2> for U16Vec2 {
2594    type Output = Self;
2595    #[inline]
2596    fn shr(self, rhs: &IVec2) -> Self {
2597        self.shr(*rhs)
2598    }
2599}
2600
2601#[cfg(feature = "i32")]
2602impl Shr<&IVec2> for &U16Vec2 {
2603    type Output = U16Vec2;
2604    #[inline]
2605    fn shr(self, rhs: &IVec2) -> U16Vec2 {
2606        (*self).shr(*rhs)
2607    }
2608}
2609
2610#[cfg(feature = "i32")]
2611impl Shr<IVec2> for &U16Vec2 {
2612    type Output = U16Vec2;
2613    #[inline]
2614    fn shr(self, rhs: IVec2) -> U16Vec2 {
2615        (*self).shr(rhs)
2616    }
2617}
2618
2619#[cfg(feature = "u32")]
2620impl Shl<UVec2> for U16Vec2 {
2621    type Output = Self;
2622    #[inline]
2623    fn shl(self, rhs: UVec2) -> Self {
2624        Self {
2625            x: self.x.shl(rhs.x),
2626            y: self.y.shl(rhs.y),
2627        }
2628    }
2629}
2630
2631#[cfg(feature = "u32")]
2632impl Shl<&UVec2> for U16Vec2 {
2633    type Output = Self;
2634    #[inline]
2635    fn shl(self, rhs: &UVec2) -> Self {
2636        self.shl(*rhs)
2637    }
2638}
2639
2640#[cfg(feature = "u32")]
2641impl Shl<&UVec2> for &U16Vec2 {
2642    type Output = U16Vec2;
2643    #[inline]
2644    fn shl(self, rhs: &UVec2) -> U16Vec2 {
2645        (*self).shl(*rhs)
2646    }
2647}
2648
2649#[cfg(feature = "u32")]
2650impl Shl<UVec2> for &U16Vec2 {
2651    type Output = U16Vec2;
2652    #[inline]
2653    fn shl(self, rhs: UVec2) -> U16Vec2 {
2654        (*self).shl(rhs)
2655    }
2656}
2657
2658#[cfg(feature = "u32")]
2659impl Shr<UVec2> for U16Vec2 {
2660    type Output = Self;
2661    #[inline]
2662    fn shr(self, rhs: UVec2) -> Self {
2663        Self {
2664            x: self.x.shr(rhs.x),
2665            y: self.y.shr(rhs.y),
2666        }
2667    }
2668}
2669
2670#[cfg(feature = "u32")]
2671impl Shr<&UVec2> for U16Vec2 {
2672    type Output = Self;
2673    #[inline]
2674    fn shr(self, rhs: &UVec2) -> Self {
2675        self.shr(*rhs)
2676    }
2677}
2678
2679#[cfg(feature = "u32")]
2680impl Shr<&UVec2> for &U16Vec2 {
2681    type Output = U16Vec2;
2682    #[inline]
2683    fn shr(self, rhs: &UVec2) -> U16Vec2 {
2684        (*self).shr(*rhs)
2685    }
2686}
2687
2688#[cfg(feature = "u32")]
2689impl Shr<UVec2> for &U16Vec2 {
2690    type Output = U16Vec2;
2691    #[inline]
2692    fn shr(self, rhs: UVec2) -> U16Vec2 {
2693        (*self).shr(rhs)
2694    }
2695}
2696
2697impl Index<usize> for U16Vec2 {
2698    type Output = u16;
2699    #[inline]
2700    fn index(&self, index: usize) -> &Self::Output {
2701        match index {
2702            0 => &self.x,
2703            1 => &self.y,
2704            _ => panic!("index out of bounds"),
2705        }
2706    }
2707}
2708
2709impl IndexMut<usize> for U16Vec2 {
2710    #[inline]
2711    fn index_mut(&mut self, index: usize) -> &mut Self::Output {
2712        match index {
2713            0 => &mut self.x,
2714            1 => &mut self.y,
2715            _ => panic!("index out of bounds"),
2716        }
2717    }
2718}
2719
2720impl fmt::Display for U16Vec2 {
2721    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2722        write!(f, "[{}, {}]", self.x, self.y)
2723    }
2724}
2725
2726impl fmt::Debug for U16Vec2 {
2727    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
2728        fmt.debug_tuple(stringify!(U16Vec2))
2729            .field(&self.x)
2730            .field(&self.y)
2731            .finish()
2732    }
2733}
2734
2735impl From<[u16; 2]> for U16Vec2 {
2736    #[inline]
2737    fn from(a: [u16; 2]) -> Self {
2738        Self::new(a[0], a[1])
2739    }
2740}
2741
2742impl From<U16Vec2> for [u16; 2] {
2743    #[inline]
2744    fn from(v: U16Vec2) -> Self {
2745        [v.x, v.y]
2746    }
2747}
2748
2749impl From<(u16, u16)> for U16Vec2 {
2750    #[inline]
2751    fn from(t: (u16, u16)) -> Self {
2752        Self::new(t.0, t.1)
2753    }
2754}
2755
2756impl From<U16Vec2> for (u16, u16) {
2757    #[inline]
2758    fn from(v: U16Vec2) -> Self {
2759        (v.x, v.y)
2760    }
2761}
2762
2763#[cfg(feature = "u8")]
2764impl From<U8Vec2> for U16Vec2 {
2765    #[inline]
2766    fn from(v: U8Vec2) -> Self {
2767        Self::new(u16::from(v.x), u16::from(v.y))
2768    }
2769}
2770
2771#[cfg(feature = "i8")]
2772impl TryFrom<I8Vec2> for U16Vec2 {
2773    type Error = core::num::TryFromIntError;
2774
2775    #[inline]
2776    fn try_from(v: I8Vec2) -> Result<Self, Self::Error> {
2777        Ok(Self::new(u16::try_from(v.x)?, u16::try_from(v.y)?))
2778    }
2779}
2780
2781#[cfg(feature = "i16")]
2782impl TryFrom<I16Vec2> for U16Vec2 {
2783    type Error = core::num::TryFromIntError;
2784
2785    #[inline]
2786    fn try_from(v: I16Vec2) -> Result<Self, Self::Error> {
2787        Ok(Self::new(u16::try_from(v.x)?, u16::try_from(v.y)?))
2788    }
2789}
2790
2791#[cfg(feature = "i32")]
2792impl TryFrom<IVec2> for U16Vec2 {
2793    type Error = core::num::TryFromIntError;
2794
2795    #[inline]
2796    fn try_from(v: IVec2) -> Result<Self, Self::Error> {
2797        Ok(Self::new(u16::try_from(v.x)?, u16::try_from(v.y)?))
2798    }
2799}
2800
2801#[cfg(feature = "u32")]
2802impl TryFrom<UVec2> for U16Vec2 {
2803    type Error = core::num::TryFromIntError;
2804
2805    #[inline]
2806    fn try_from(v: UVec2) -> Result<Self, Self::Error> {
2807        Ok(Self::new(u16::try_from(v.x)?, u16::try_from(v.y)?))
2808    }
2809}
2810
2811#[cfg(feature = "i64")]
2812impl TryFrom<I64Vec2> for U16Vec2 {
2813    type Error = core::num::TryFromIntError;
2814
2815    #[inline]
2816    fn try_from(v: I64Vec2) -> Result<Self, Self::Error> {
2817        Ok(Self::new(u16::try_from(v.x)?, u16::try_from(v.y)?))
2818    }
2819}
2820
2821#[cfg(feature = "u64")]
2822impl TryFrom<U64Vec2> for U16Vec2 {
2823    type Error = core::num::TryFromIntError;
2824
2825    #[inline]
2826    fn try_from(v: U64Vec2) -> Result<Self, Self::Error> {
2827        Ok(Self::new(u16::try_from(v.x)?, u16::try_from(v.y)?))
2828    }
2829}
2830
2831#[cfg(feature = "isize")]
2832impl TryFrom<ISizeVec2> for U16Vec2 {
2833    type Error = core::num::TryFromIntError;
2834
2835    #[inline]
2836    fn try_from(v: ISizeVec2) -> Result<Self, Self::Error> {
2837        Ok(Self::new(u16::try_from(v.x)?, u16::try_from(v.y)?))
2838    }
2839}
2840
2841#[cfg(feature = "usize")]
2842impl TryFrom<USizeVec2> for U16Vec2 {
2843    type Error = core::num::TryFromIntError;
2844
2845    #[inline]
2846    fn try_from(v: USizeVec2) -> Result<Self, Self::Error> {
2847        Ok(Self::new(u16::try_from(v.x)?, u16::try_from(v.y)?))
2848    }
2849}
2850
2851impl From<BVec2> for U16Vec2 {
2852    #[inline]
2853    fn from(v: BVec2) -> Self {
2854        Self::new(u16::from(v.x), u16::from(v.y))
2855    }
2856}