glam/u16/
u16vec2.rs

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