1 // Generated from vec.rs.tera template. Edit the template, not the generated file.
2
3 use crate::{
4 BVec3, BVec3A, I16Vec3, I64Vec3, I8Vec3, IVec3, U16Vec2, U16Vec4, U64Vec3, U8Vec3, UVec3,
5 };
6
7 use core::fmt;
8 use core::iter::{Product, Sum};
9 use core::{f32, ops::*};
10
11 /// Creates a 3-dimensional vector.
12 #[inline(always)]
13 #[must_use]
u16vec3(x: u16, y: u16, z: u16) -> U16Vec314 pub const fn u16vec3(x: u16, y: u16, z: u16) -> U16Vec3 {
15 U16Vec3::new(x, y, z)
16 }
17
18 /// A 3-dimensional vector.
19 #[cfg_attr(not(target_arch = "spirv"), derive(Hash))]
20 #[derive(Clone, Copy, PartialEq, Eq)]
21 #[cfg_attr(not(target_arch = "spirv"), repr(C))]
22 #[cfg_attr(target_arch = "spirv", repr(simd))]
23 pub struct U16Vec3 {
24 pub x: u16,
25 pub y: u16,
26 pub z: u16,
27 }
28
29 impl U16Vec3 {
30 /// All zeroes.
31 pub const ZERO: Self = Self::splat(0);
32
33 /// All ones.
34 pub const ONE: Self = Self::splat(1);
35
36 /// All `u16::MIN`.
37 pub const MIN: Self = Self::splat(u16::MIN);
38
39 /// All `u16::MAX`.
40 pub const MAX: Self = Self::splat(u16::MAX);
41
42 /// A unit vector pointing along the positive X axis.
43 pub const X: Self = Self::new(1, 0, 0);
44
45 /// A unit vector pointing along the positive Y axis.
46 pub const Y: Self = Self::new(0, 1, 0);
47
48 /// A unit vector pointing along the positive Z axis.
49 pub const Z: Self = Self::new(0, 0, 1);
50
51 /// The unit axes.
52 pub const AXES: [Self; 3] = [Self::X, Self::Y, Self::Z];
53
54 /// Creates a new vector.
55 #[inline(always)]
56 #[must_use]
new(x: u16, y: u16, z: u16) -> Self57 pub const fn new(x: u16, y: u16, z: u16) -> Self {
58 Self { x, y, z }
59 }
60
61 /// Creates a vector with all elements set to `v`.
62 #[inline]
63 #[must_use]
splat(v: u16) -> Self64 pub const fn splat(v: u16) -> Self {
65 Self { x: v, y: v, z: v }
66 }
67
68 /// Returns a vector containing each element of `self` modified by a mapping function `f`.
69 #[inline]
70 #[must_use]
map<F>(self, f: F) -> Self where F: Fn(u16) -> u16,71 pub fn map<F>(self, f: F) -> Self
72 where
73 F: Fn(u16) -> u16,
74 {
75 Self::new(f(self.x), f(self.y), f(self.z))
76 }
77
78 /// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use
79 /// for each element of `self`.
80 ///
81 /// A true element in the mask uses the corresponding element from `if_true`, and false
82 /// uses the element from `if_false`.
83 #[inline]
84 #[must_use]
select(mask: BVec3, if_true: Self, if_false: Self) -> Self85 pub fn select(mask: BVec3, if_true: Self, if_false: Self) -> Self {
86 Self {
87 x: if mask.test(0) { if_true.x } else { if_false.x },
88 y: if mask.test(1) { if_true.y } else { if_false.y },
89 z: if mask.test(2) { if_true.z } else { if_false.z },
90 }
91 }
92
93 /// Creates a new vector from an array.
94 #[inline]
95 #[must_use]
from_array(a: [u16; 3]) -> Self96 pub const fn from_array(a: [u16; 3]) -> Self {
97 Self::new(a[0], a[1], a[2])
98 }
99
100 /// `[x, y, z]`
101 #[inline]
102 #[must_use]
to_array(&self) -> [u16; 3]103 pub const fn to_array(&self) -> [u16; 3] {
104 [self.x, self.y, self.z]
105 }
106
107 /// Creates a vector from the first 3 values in `slice`.
108 ///
109 /// # Panics
110 ///
111 /// Panics if `slice` is less than 3 elements long.
112 #[inline]
113 #[must_use]
from_slice(slice: &[u16]) -> Self114 pub const fn from_slice(slice: &[u16]) -> Self {
115 assert!(slice.len() >= 3);
116 Self::new(slice[0], slice[1], slice[2])
117 }
118
119 /// Writes the elements of `self` to the first 3 elements in `slice`.
120 ///
121 /// # Panics
122 ///
123 /// Panics if `slice` is less than 3 elements long.
124 #[inline]
write_to_slice(self, slice: &mut [u16])125 pub fn write_to_slice(self, slice: &mut [u16]) {
126 slice[..3].copy_from_slice(&self.to_array());
127 }
128
129 /// Internal method for creating a 3D vector from a 4D vector, discarding `w`.
130 #[allow(dead_code)]
131 #[inline]
132 #[must_use]
from_vec4(v: U16Vec4) -> Self133 pub(crate) fn from_vec4(v: U16Vec4) -> Self {
134 Self {
135 x: v.x,
136 y: v.y,
137 z: v.z,
138 }
139 }
140
141 /// Creates a 4D vector from `self` and the given `w` value.
142 #[inline]
143 #[must_use]
extend(self, w: u16) -> U16Vec4144 pub fn extend(self, w: u16) -> U16Vec4 {
145 U16Vec4::new(self.x, self.y, self.z, w)
146 }
147
148 /// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`.
149 ///
150 /// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()].
151 #[inline]
152 #[must_use]
truncate(self) -> U16Vec2153 pub fn truncate(self) -> U16Vec2 {
154 use crate::swizzles::Vec3Swizzles;
155 self.xy()
156 }
157
158 /// Creates a 3D vector from `self` with the given value of `x`.
159 #[inline]
160 #[must_use]
with_x(mut self, x: u16) -> Self161 pub fn with_x(mut self, x: u16) -> Self {
162 self.x = x;
163 self
164 }
165
166 /// Creates a 3D vector from `self` with the given value of `y`.
167 #[inline]
168 #[must_use]
with_y(mut self, y: u16) -> Self169 pub fn with_y(mut self, y: u16) -> Self {
170 self.y = y;
171 self
172 }
173
174 /// Creates a 3D vector from `self` with the given value of `z`.
175 #[inline]
176 #[must_use]
with_z(mut self, z: u16) -> Self177 pub fn with_z(mut self, z: u16) -> Self {
178 self.z = z;
179 self
180 }
181
182 /// Computes the dot product of `self` and `rhs`.
183 #[inline]
184 #[must_use]
dot(self, rhs: Self) -> u16185 pub fn dot(self, rhs: Self) -> u16 {
186 (self.x * rhs.x) + (self.y * rhs.y) + (self.z * rhs.z)
187 }
188
189 /// Returns a vector where every component is the dot product of `self` and `rhs`.
190 #[inline]
191 #[must_use]
dot_into_vec(self, rhs: Self) -> Self192 pub fn dot_into_vec(self, rhs: Self) -> Self {
193 Self::splat(self.dot(rhs))
194 }
195
196 /// Computes the cross product of `self` and `rhs`.
197 #[inline]
198 #[must_use]
cross(self, rhs: Self) -> Self199 pub fn cross(self, rhs: Self) -> Self {
200 Self {
201 x: self.y * rhs.z - rhs.y * self.z,
202 y: self.z * rhs.x - rhs.z * self.x,
203 z: self.x * rhs.y - rhs.x * self.y,
204 }
205 }
206
207 /// Returns a vector containing the minimum values for each element of `self` and `rhs`.
208 ///
209 /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`.
210 #[inline]
211 #[must_use]
min(self, rhs: Self) -> Self212 pub fn min(self, rhs: Self) -> Self {
213 Self {
214 x: self.x.min(rhs.x),
215 y: self.y.min(rhs.y),
216 z: self.z.min(rhs.z),
217 }
218 }
219
220 /// Returns a vector containing the maximum values for each element of `self` and `rhs`.
221 ///
222 /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`.
223 #[inline]
224 #[must_use]
max(self, rhs: Self) -> Self225 pub fn max(self, rhs: Self) -> Self {
226 Self {
227 x: self.x.max(rhs.x),
228 y: self.y.max(rhs.y),
229 z: self.z.max(rhs.z),
230 }
231 }
232
233 /// Component-wise clamping of values, similar to [`u16::clamp`].
234 ///
235 /// Each element in `min` must be less-or-equal to the corresponding element in `max`.
236 ///
237 /// # Panics
238 ///
239 /// Will panic if `min` is greater than `max` when `glam_assert` is enabled.
240 #[inline]
241 #[must_use]
clamp(self, min: Self, max: Self) -> Self242 pub fn clamp(self, min: Self, max: Self) -> Self {
243 glam_assert!(min.cmple(max).all(), "clamp: expected min <= max");
244 self.max(min).min(max)
245 }
246
247 /// Returns the horizontal minimum of `self`.
248 ///
249 /// In other words this computes `min(x, y, ..)`.
250 #[inline]
251 #[must_use]
min_element(self) -> u16252 pub fn min_element(self) -> u16 {
253 self.x.min(self.y.min(self.z))
254 }
255
256 /// Returns the horizontal maximum of `self`.
257 ///
258 /// In other words this computes `max(x, y, ..)`.
259 #[inline]
260 #[must_use]
max_element(self) -> u16261 pub fn max_element(self) -> u16 {
262 self.x.max(self.y.max(self.z))
263 }
264
265 /// Returns the sum of all elements of `self`.
266 ///
267 /// In other words, this computes `self.x + self.y + ..`.
268 #[inline]
269 #[must_use]
element_sum(self) -> u16270 pub fn element_sum(self) -> u16 {
271 self.x + self.y + self.z
272 }
273
274 /// Returns the product of all elements of `self`.
275 ///
276 /// In other words, this computes `self.x * self.y * ..`.
277 #[inline]
278 #[must_use]
element_product(self) -> u16279 pub fn element_product(self) -> u16 {
280 self.x * self.y * self.z
281 }
282
283 /// Returns a vector mask containing the result of a `==` comparison for each element of
284 /// `self` and `rhs`.
285 ///
286 /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all
287 /// elements.
288 #[inline]
289 #[must_use]
cmpeq(self, rhs: Self) -> BVec3290 pub fn cmpeq(self, rhs: Self) -> BVec3 {
291 BVec3::new(self.x.eq(&rhs.x), self.y.eq(&rhs.y), self.z.eq(&rhs.z))
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]
cmpne(self, rhs: Self) -> BVec3301 pub fn cmpne(self, rhs: Self) -> BVec3 {
302 BVec3::new(self.x.ne(&rhs.x), self.y.ne(&rhs.y), self.z.ne(&rhs.z))
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]
cmpge(self, rhs: Self) -> BVec3312 pub fn cmpge(self, rhs: Self) -> BVec3 {
313 BVec3::new(self.x.ge(&rhs.x), self.y.ge(&rhs.y), self.z.ge(&rhs.z))
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]
cmpgt(self, rhs: Self) -> BVec3323 pub fn cmpgt(self, rhs: Self) -> BVec3 {
324 BVec3::new(self.x.gt(&rhs.x), self.y.gt(&rhs.y), self.z.gt(&rhs.z))
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]
cmple(self, rhs: Self) -> BVec3334 pub fn cmple(self, rhs: Self) -> BVec3 {
335 BVec3::new(self.x.le(&rhs.x), self.y.le(&rhs.y), self.z.le(&rhs.z))
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]
cmplt(self, rhs: Self) -> BVec3345 pub fn cmplt(self, rhs: Self) -> BVec3 {
346 BVec3::new(self.x.lt(&rhs.x), self.y.lt(&rhs.y), self.z.lt(&rhs.z))
347 }
348
349 /// Computes the squared length of `self`.
350 #[doc(alias = "magnitude2")]
351 #[inline]
352 #[must_use]
length_squared(self) -> u16353 pub fn length_squared(self) -> u16 {
354 self.dot(self)
355 }
356
357 /// Computes the [manhattan distance] between two points.
358 ///
359 /// # Overflow
360 /// This method may overflow if the result is greater than [`u16::MAX`].
361 ///
362 /// See also [`checked_manhattan_distance`][U16Vec3::checked_manhattan_distance].
363 ///
364 /// [manhattan distance]: https://en.wikipedia.org/wiki/Taxicab_geometry
365 #[inline]
366 #[must_use]
manhattan_distance(self, other: Self) -> u16367 pub fn manhattan_distance(self, other: Self) -> u16 {
368 self.x.abs_diff(other.x) + self.y.abs_diff(other.y) + self.z.abs_diff(other.z)
369 }
370
371 /// Computes the [manhattan distance] between two points.
372 ///
373 /// This will returns [`None`] if the result is greater than [`u16::MAX`].
374 ///
375 /// [manhattan distance]: https://en.wikipedia.org/wiki/Taxicab_geometry
376 #[inline]
377 #[must_use]
checked_manhattan_distance(self, other: Self) -> Option<u16>378 pub fn checked_manhattan_distance(self, other: Self) -> Option<u16> {
379 let d = self.x.abs_diff(other.x);
380 let d = d.checked_add(self.y.abs_diff(other.y))?;
381 d.checked_add(self.z.abs_diff(other.z))
382 }
383
384 /// Computes the [chebyshev distance] between two points.
385 ///
386 /// [chebyshev distance]: https://en.wikipedia.org/wiki/Chebyshev_distance
387 #[inline]
388 #[must_use]
chebyshev_distance(self, other: Self) -> u16389 pub fn chebyshev_distance(self, other: Self) -> u16 {
390 // Note: the compiler will eventually optimize out the loop
391 [
392 self.x.abs_diff(other.x),
393 self.y.abs_diff(other.y),
394 self.z.abs_diff(other.z),
395 ]
396 .into_iter()
397 .max()
398 .unwrap()
399 }
400
401 /// Casts all elements of `self` to `f32`.
402 #[inline]
403 #[must_use]
as_vec3(&self) -> crate::Vec3404 pub fn as_vec3(&self) -> crate::Vec3 {
405 crate::Vec3::new(self.x as f32, self.y as f32, self.z as f32)
406 }
407
408 /// Casts all elements of `self` to `f32`.
409 #[inline]
410 #[must_use]
as_vec3a(&self) -> crate::Vec3A411 pub fn as_vec3a(&self) -> crate::Vec3A {
412 crate::Vec3A::new(self.x as f32, self.y as f32, self.z as f32)
413 }
414
415 /// Casts all elements of `self` to `f64`.
416 #[inline]
417 #[must_use]
as_dvec3(&self) -> crate::DVec3418 pub fn as_dvec3(&self) -> crate::DVec3 {
419 crate::DVec3::new(self.x as f64, self.y as f64, self.z as f64)
420 }
421
422 /// Casts all elements of `self` to `i8`.
423 #[inline]
424 #[must_use]
as_i8vec3(&self) -> crate::I8Vec3425 pub fn as_i8vec3(&self) -> crate::I8Vec3 {
426 crate::I8Vec3::new(self.x as i8, self.y as i8, self.z as i8)
427 }
428
429 /// Casts all elements of `self` to `u8`.
430 #[inline]
431 #[must_use]
as_u8vec3(&self) -> crate::U8Vec3432 pub fn as_u8vec3(&self) -> crate::U8Vec3 {
433 crate::U8Vec3::new(self.x as u8, self.y as u8, self.z as u8)
434 }
435
436 /// Casts all elements of `self` to `i16`.
437 #[inline]
438 #[must_use]
as_i16vec3(&self) -> crate::I16Vec3439 pub fn as_i16vec3(&self) -> crate::I16Vec3 {
440 crate::I16Vec3::new(self.x as i16, self.y as i16, self.z as i16)
441 }
442
443 /// Casts all elements of `self` to `i32`.
444 #[inline]
445 #[must_use]
as_ivec3(&self) -> crate::IVec3446 pub fn as_ivec3(&self) -> crate::IVec3 {
447 crate::IVec3::new(self.x as i32, self.y as i32, self.z as i32)
448 }
449
450 /// Casts all elements of `self` to `u32`.
451 #[inline]
452 #[must_use]
as_uvec3(&self) -> crate::UVec3453 pub fn as_uvec3(&self) -> crate::UVec3 {
454 crate::UVec3::new(self.x as u32, self.y as u32, self.z as u32)
455 }
456
457 /// Casts all elements of `self` to `i64`.
458 #[inline]
459 #[must_use]
as_i64vec3(&self) -> crate::I64Vec3460 pub fn as_i64vec3(&self) -> crate::I64Vec3 {
461 crate::I64Vec3::new(self.x as i64, self.y as i64, self.z as i64)
462 }
463
464 /// Casts all elements of `self` to `u64`.
465 #[inline]
466 #[must_use]
as_u64vec3(&self) -> crate::U64Vec3467 pub fn as_u64vec3(&self) -> crate::U64Vec3 {
468 crate::U64Vec3::new(self.x as u64, self.y as u64, self.z as u64)
469 }
470
471 /// Returns a vector containing the wrapping addition of `self` and `rhs`.
472 ///
473 /// In other words this computes `Some([self.x + rhs.x, self.y + rhs.y, ..])` but returns `None` on any overflow.
474 #[inline]
475 #[must_use]
checked_add(self, rhs: Self) -> Option<Self>476 pub const fn checked_add(self, rhs: Self) -> Option<Self> {
477 let x = match self.x.checked_add(rhs.x) {
478 Some(v) => v,
479 None => return None,
480 };
481 let y = match self.y.checked_add(rhs.y) {
482 Some(v) => v,
483 None => return None,
484 };
485 let z = match self.z.checked_add(rhs.z) {
486 Some(v) => v,
487 None => return None,
488 };
489
490 Some(Self { x, y, z })
491 }
492
493 /// Returns a vector containing the wrapping subtraction of `self` and `rhs`.
494 ///
495 /// In other words this computes `Some([self.x - rhs.x, self.y - rhs.y, ..])` but returns `None` on any overflow.
496 #[inline]
497 #[must_use]
checked_sub(self, rhs: Self) -> Option<Self>498 pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
499 let x = match self.x.checked_sub(rhs.x) {
500 Some(v) => v,
501 None => return None,
502 };
503 let y = match self.y.checked_sub(rhs.y) {
504 Some(v) => v,
505 None => return None,
506 };
507 let z = match self.z.checked_sub(rhs.z) {
508 Some(v) => v,
509 None => return None,
510 };
511
512 Some(Self { x, y, z })
513 }
514
515 /// Returns a vector containing the wrapping multiplication of `self` and `rhs`.
516 ///
517 /// In other words this computes `Some([self.x * rhs.x, self.y * rhs.y, ..])` but returns `None` on any overflow.
518 #[inline]
519 #[must_use]
checked_mul(self, rhs: Self) -> Option<Self>520 pub const fn checked_mul(self, rhs: Self) -> Option<Self> {
521 let x = match self.x.checked_mul(rhs.x) {
522 Some(v) => v,
523 None => return None,
524 };
525 let y = match self.y.checked_mul(rhs.y) {
526 Some(v) => v,
527 None => return None,
528 };
529 let z = match self.z.checked_mul(rhs.z) {
530 Some(v) => v,
531 None => return None,
532 };
533
534 Some(Self { x, y, z })
535 }
536
537 /// Returns a vector containing the wrapping division of `self` and `rhs`.
538 ///
539 /// In other words this computes `Some([self.x / rhs.x, self.y / rhs.y, ..])` but returns `None` on any division by zero.
540 #[inline]
541 #[must_use]
checked_div(self, rhs: Self) -> Option<Self>542 pub const fn checked_div(self, rhs: Self) -> Option<Self> {
543 let x = match self.x.checked_div(rhs.x) {
544 Some(v) => v,
545 None => return None,
546 };
547 let y = match self.y.checked_div(rhs.y) {
548 Some(v) => v,
549 None => return None,
550 };
551 let z = match self.z.checked_div(rhs.z) {
552 Some(v) => v,
553 None => return None,
554 };
555
556 Some(Self { x, y, z })
557 }
558
559 /// Returns a vector containing the wrapping addition of `self` and `rhs`.
560 ///
561 /// In other words this computes `[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]`.
562 #[inline]
563 #[must_use]
wrapping_add(self, rhs: Self) -> Self564 pub const fn wrapping_add(self, rhs: Self) -> Self {
565 Self {
566 x: self.x.wrapping_add(rhs.x),
567 y: self.y.wrapping_add(rhs.y),
568 z: self.z.wrapping_add(rhs.z),
569 }
570 }
571
572 /// Returns a vector containing the wrapping subtraction of `self` and `rhs`.
573 ///
574 /// In other words this computes `[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]`.
575 #[inline]
576 #[must_use]
wrapping_sub(self, rhs: Self) -> Self577 pub const fn wrapping_sub(self, rhs: Self) -> Self {
578 Self {
579 x: self.x.wrapping_sub(rhs.x),
580 y: self.y.wrapping_sub(rhs.y),
581 z: self.z.wrapping_sub(rhs.z),
582 }
583 }
584
585 /// Returns a vector containing the wrapping multiplication of `self` and `rhs`.
586 ///
587 /// In other words this computes `[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]`.
588 #[inline]
589 #[must_use]
wrapping_mul(self, rhs: Self) -> Self590 pub const fn wrapping_mul(self, rhs: Self) -> Self {
591 Self {
592 x: self.x.wrapping_mul(rhs.x),
593 y: self.y.wrapping_mul(rhs.y),
594 z: self.z.wrapping_mul(rhs.z),
595 }
596 }
597
598 /// Returns a vector containing the wrapping division of `self` and `rhs`.
599 ///
600 /// In other words this computes `[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]`.
601 #[inline]
602 #[must_use]
wrapping_div(self, rhs: Self) -> Self603 pub const fn wrapping_div(self, rhs: Self) -> Self {
604 Self {
605 x: self.x.wrapping_div(rhs.x),
606 y: self.y.wrapping_div(rhs.y),
607 z: self.z.wrapping_div(rhs.z),
608 }
609 }
610
611 /// Returns a vector containing the saturating addition of `self` and `rhs`.
612 ///
613 /// In other words this computes `[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]`.
614 #[inline]
615 #[must_use]
saturating_add(self, rhs: Self) -> Self616 pub const fn saturating_add(self, rhs: Self) -> Self {
617 Self {
618 x: self.x.saturating_add(rhs.x),
619 y: self.y.saturating_add(rhs.y),
620 z: self.z.saturating_add(rhs.z),
621 }
622 }
623
624 /// Returns a vector containing the saturating subtraction of `self` and `rhs`.
625 ///
626 /// In other words this computes `[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]`.
627 #[inline]
628 #[must_use]
saturating_sub(self, rhs: Self) -> Self629 pub const fn saturating_sub(self, rhs: Self) -> Self {
630 Self {
631 x: self.x.saturating_sub(rhs.x),
632 y: self.y.saturating_sub(rhs.y),
633 z: self.z.saturating_sub(rhs.z),
634 }
635 }
636
637 /// Returns a vector containing the saturating multiplication of `self` and `rhs`.
638 ///
639 /// In other words this computes `[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]`.
640 #[inline]
641 #[must_use]
saturating_mul(self, rhs: Self) -> Self642 pub const fn saturating_mul(self, rhs: Self) -> Self {
643 Self {
644 x: self.x.saturating_mul(rhs.x),
645 y: self.y.saturating_mul(rhs.y),
646 z: self.z.saturating_mul(rhs.z),
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]
saturating_div(self, rhs: Self) -> Self655 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 z: self.z.saturating_div(rhs.z),
660 }
661 }
662
663 /// Returns a vector containing the wrapping addition of `self` and signed vector `rhs`.
664 ///
665 /// In other words this computes `Some([self.x + rhs.x, self.y + rhs.y, ..])` but returns `None` on any overflow.
666 #[inline]
667 #[must_use]
checked_add_signed(self, rhs: I16Vec3) -> Option<Self>668 pub const fn checked_add_signed(self, rhs: I16Vec3) -> 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 let z = match self.z.checked_add_signed(rhs.z) {
678 Some(v) => v,
679 None => return None,
680 };
681
682 Some(Self { x, y, z })
683 }
684
685 /// Returns a vector containing the wrapping addition of `self` and signed vector `rhs`.
686 ///
687 /// In other words this computes `[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]`.
688 #[inline]
689 #[must_use]
wrapping_add_signed(self, rhs: I16Vec3) -> Self690 pub const fn wrapping_add_signed(self, rhs: I16Vec3) -> Self {
691 Self {
692 x: self.x.wrapping_add_signed(rhs.x),
693 y: self.y.wrapping_add_signed(rhs.y),
694 z: self.z.wrapping_add_signed(rhs.z),
695 }
696 }
697
698 /// Returns a vector containing the saturating addition of `self` and signed vector `rhs`.
699 ///
700 /// In other words this computes `[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]`.
701 #[inline]
702 #[must_use]
saturating_add_signed(self, rhs: I16Vec3) -> Self703 pub const fn saturating_add_signed(self, rhs: I16Vec3) -> Self {
704 Self {
705 x: self.x.saturating_add_signed(rhs.x),
706 y: self.y.saturating_add_signed(rhs.y),
707 z: self.z.saturating_add_signed(rhs.z),
708 }
709 }
710 }
711
712 impl Default for U16Vec3 {
713 #[inline(always)]
default() -> Self714 fn default() -> Self {
715 Self::ZERO
716 }
717 }
718
719 impl Div<U16Vec3> for U16Vec3 {
720 type Output = Self;
721 #[inline]
div(self, rhs: Self) -> Self722 fn div(self, rhs: Self) -> Self {
723 Self {
724 x: self.x.div(rhs.x),
725 y: self.y.div(rhs.y),
726 z: self.z.div(rhs.z),
727 }
728 }
729 }
730
731 impl Div<&U16Vec3> for U16Vec3 {
732 type Output = U16Vec3;
733 #[inline]
div(self, rhs: &U16Vec3) -> U16Vec3734 fn div(self, rhs: &U16Vec3) -> U16Vec3 {
735 self.div(*rhs)
736 }
737 }
738
739 impl Div<&U16Vec3> for &U16Vec3 {
740 type Output = U16Vec3;
741 #[inline]
div(self, rhs: &U16Vec3) -> U16Vec3742 fn div(self, rhs: &U16Vec3) -> U16Vec3 {
743 (*self).div(*rhs)
744 }
745 }
746
747 impl Div<U16Vec3> for &U16Vec3 {
748 type Output = U16Vec3;
749 #[inline]
div(self, rhs: U16Vec3) -> U16Vec3750 fn div(self, rhs: U16Vec3) -> U16Vec3 {
751 (*self).div(rhs)
752 }
753 }
754
755 impl DivAssign<U16Vec3> for U16Vec3 {
756 #[inline]
div_assign(&mut self, rhs: Self)757 fn div_assign(&mut self, rhs: Self) {
758 self.x.div_assign(rhs.x);
759 self.y.div_assign(rhs.y);
760 self.z.div_assign(rhs.z);
761 }
762 }
763
764 impl DivAssign<&U16Vec3> for U16Vec3 {
765 #[inline]
div_assign(&mut self, rhs: &U16Vec3)766 fn div_assign(&mut self, rhs: &U16Vec3) {
767 self.div_assign(*rhs)
768 }
769 }
770
771 impl Div<u16> for U16Vec3 {
772 type Output = Self;
773 #[inline]
div(self, rhs: u16) -> Self774 fn div(self, rhs: u16) -> Self {
775 Self {
776 x: self.x.div(rhs),
777 y: self.y.div(rhs),
778 z: self.z.div(rhs),
779 }
780 }
781 }
782
783 impl Div<&u16> for U16Vec3 {
784 type Output = U16Vec3;
785 #[inline]
div(self, rhs: &u16) -> U16Vec3786 fn div(self, rhs: &u16) -> U16Vec3 {
787 self.div(*rhs)
788 }
789 }
790
791 impl Div<&u16> for &U16Vec3 {
792 type Output = U16Vec3;
793 #[inline]
div(self, rhs: &u16) -> U16Vec3794 fn div(self, rhs: &u16) -> U16Vec3 {
795 (*self).div(*rhs)
796 }
797 }
798
799 impl Div<u16> for &U16Vec3 {
800 type Output = U16Vec3;
801 #[inline]
div(self, rhs: u16) -> U16Vec3802 fn div(self, rhs: u16) -> U16Vec3 {
803 (*self).div(rhs)
804 }
805 }
806
807 impl DivAssign<u16> for U16Vec3 {
808 #[inline]
div_assign(&mut self, rhs: u16)809 fn div_assign(&mut self, rhs: u16) {
810 self.x.div_assign(rhs);
811 self.y.div_assign(rhs);
812 self.z.div_assign(rhs);
813 }
814 }
815
816 impl DivAssign<&u16> for U16Vec3 {
817 #[inline]
div_assign(&mut self, rhs: &u16)818 fn div_assign(&mut self, rhs: &u16) {
819 self.div_assign(*rhs)
820 }
821 }
822
823 impl Div<U16Vec3> for u16 {
824 type Output = U16Vec3;
825 #[inline]
div(self, rhs: U16Vec3) -> U16Vec3826 fn div(self, rhs: U16Vec3) -> U16Vec3 {
827 U16Vec3 {
828 x: self.div(rhs.x),
829 y: self.div(rhs.y),
830 z: self.div(rhs.z),
831 }
832 }
833 }
834
835 impl Div<&U16Vec3> for u16 {
836 type Output = U16Vec3;
837 #[inline]
div(self, rhs: &U16Vec3) -> U16Vec3838 fn div(self, rhs: &U16Vec3) -> U16Vec3 {
839 self.div(*rhs)
840 }
841 }
842
843 impl Div<&U16Vec3> for &u16 {
844 type Output = U16Vec3;
845 #[inline]
div(self, rhs: &U16Vec3) -> U16Vec3846 fn div(self, rhs: &U16Vec3) -> U16Vec3 {
847 (*self).div(*rhs)
848 }
849 }
850
851 impl Div<U16Vec3> for &u16 {
852 type Output = U16Vec3;
853 #[inline]
div(self, rhs: U16Vec3) -> U16Vec3854 fn div(self, rhs: U16Vec3) -> U16Vec3 {
855 (*self).div(rhs)
856 }
857 }
858
859 impl Mul<U16Vec3> for U16Vec3 {
860 type Output = Self;
861 #[inline]
mul(self, rhs: Self) -> Self862 fn mul(self, rhs: Self) -> Self {
863 Self {
864 x: self.x.mul(rhs.x),
865 y: self.y.mul(rhs.y),
866 z: self.z.mul(rhs.z),
867 }
868 }
869 }
870
871 impl Mul<&U16Vec3> for U16Vec3 {
872 type Output = U16Vec3;
873 #[inline]
mul(self, rhs: &U16Vec3) -> U16Vec3874 fn mul(self, rhs: &U16Vec3) -> U16Vec3 {
875 self.mul(*rhs)
876 }
877 }
878
879 impl Mul<&U16Vec3> for &U16Vec3 {
880 type Output = U16Vec3;
881 #[inline]
mul(self, rhs: &U16Vec3) -> U16Vec3882 fn mul(self, rhs: &U16Vec3) -> U16Vec3 {
883 (*self).mul(*rhs)
884 }
885 }
886
887 impl Mul<U16Vec3> for &U16Vec3 {
888 type Output = U16Vec3;
889 #[inline]
mul(self, rhs: U16Vec3) -> U16Vec3890 fn mul(self, rhs: U16Vec3) -> U16Vec3 {
891 (*self).mul(rhs)
892 }
893 }
894
895 impl MulAssign<U16Vec3> for U16Vec3 {
896 #[inline]
mul_assign(&mut self, rhs: Self)897 fn mul_assign(&mut self, rhs: Self) {
898 self.x.mul_assign(rhs.x);
899 self.y.mul_assign(rhs.y);
900 self.z.mul_assign(rhs.z);
901 }
902 }
903
904 impl MulAssign<&U16Vec3> for U16Vec3 {
905 #[inline]
mul_assign(&mut self, rhs: &U16Vec3)906 fn mul_assign(&mut self, rhs: &U16Vec3) {
907 self.mul_assign(*rhs)
908 }
909 }
910
911 impl Mul<u16> for U16Vec3 {
912 type Output = Self;
913 #[inline]
mul(self, rhs: u16) -> Self914 fn mul(self, rhs: u16) -> Self {
915 Self {
916 x: self.x.mul(rhs),
917 y: self.y.mul(rhs),
918 z: self.z.mul(rhs),
919 }
920 }
921 }
922
923 impl Mul<&u16> for U16Vec3 {
924 type Output = U16Vec3;
925 #[inline]
mul(self, rhs: &u16) -> U16Vec3926 fn mul(self, rhs: &u16) -> U16Vec3 {
927 self.mul(*rhs)
928 }
929 }
930
931 impl Mul<&u16> for &U16Vec3 {
932 type Output = U16Vec3;
933 #[inline]
mul(self, rhs: &u16) -> U16Vec3934 fn mul(self, rhs: &u16) -> U16Vec3 {
935 (*self).mul(*rhs)
936 }
937 }
938
939 impl Mul<u16> for &U16Vec3 {
940 type Output = U16Vec3;
941 #[inline]
mul(self, rhs: u16) -> U16Vec3942 fn mul(self, rhs: u16) -> U16Vec3 {
943 (*self).mul(rhs)
944 }
945 }
946
947 impl MulAssign<u16> for U16Vec3 {
948 #[inline]
mul_assign(&mut self, rhs: u16)949 fn mul_assign(&mut self, rhs: u16) {
950 self.x.mul_assign(rhs);
951 self.y.mul_assign(rhs);
952 self.z.mul_assign(rhs);
953 }
954 }
955
956 impl MulAssign<&u16> for U16Vec3 {
957 #[inline]
mul_assign(&mut self, rhs: &u16)958 fn mul_assign(&mut self, rhs: &u16) {
959 self.mul_assign(*rhs)
960 }
961 }
962
963 impl Mul<U16Vec3> for u16 {
964 type Output = U16Vec3;
965 #[inline]
mul(self, rhs: U16Vec3) -> U16Vec3966 fn mul(self, rhs: U16Vec3) -> U16Vec3 {
967 U16Vec3 {
968 x: self.mul(rhs.x),
969 y: self.mul(rhs.y),
970 z: self.mul(rhs.z),
971 }
972 }
973 }
974
975 impl Mul<&U16Vec3> for u16 {
976 type Output = U16Vec3;
977 #[inline]
mul(self, rhs: &U16Vec3) -> U16Vec3978 fn mul(self, rhs: &U16Vec3) -> U16Vec3 {
979 self.mul(*rhs)
980 }
981 }
982
983 impl Mul<&U16Vec3> for &u16 {
984 type Output = U16Vec3;
985 #[inline]
mul(self, rhs: &U16Vec3) -> U16Vec3986 fn mul(self, rhs: &U16Vec3) -> U16Vec3 {
987 (*self).mul(*rhs)
988 }
989 }
990
991 impl Mul<U16Vec3> for &u16 {
992 type Output = U16Vec3;
993 #[inline]
mul(self, rhs: U16Vec3) -> U16Vec3994 fn mul(self, rhs: U16Vec3) -> U16Vec3 {
995 (*self).mul(rhs)
996 }
997 }
998
999 impl Add<U16Vec3> for U16Vec3 {
1000 type Output = Self;
1001 #[inline]
add(self, rhs: Self) -> Self1002 fn add(self, rhs: Self) -> Self {
1003 Self {
1004 x: self.x.add(rhs.x),
1005 y: self.y.add(rhs.y),
1006 z: self.z.add(rhs.z),
1007 }
1008 }
1009 }
1010
1011 impl Add<&U16Vec3> for U16Vec3 {
1012 type Output = U16Vec3;
1013 #[inline]
add(self, rhs: &U16Vec3) -> U16Vec31014 fn add(self, rhs: &U16Vec3) -> U16Vec3 {
1015 self.add(*rhs)
1016 }
1017 }
1018
1019 impl Add<&U16Vec3> for &U16Vec3 {
1020 type Output = U16Vec3;
1021 #[inline]
add(self, rhs: &U16Vec3) -> U16Vec31022 fn add(self, rhs: &U16Vec3) -> U16Vec3 {
1023 (*self).add(*rhs)
1024 }
1025 }
1026
1027 impl Add<U16Vec3> for &U16Vec3 {
1028 type Output = U16Vec3;
1029 #[inline]
add(self, rhs: U16Vec3) -> U16Vec31030 fn add(self, rhs: U16Vec3) -> U16Vec3 {
1031 (*self).add(rhs)
1032 }
1033 }
1034
1035 impl AddAssign<U16Vec3> for U16Vec3 {
1036 #[inline]
add_assign(&mut self, rhs: Self)1037 fn add_assign(&mut self, rhs: Self) {
1038 self.x.add_assign(rhs.x);
1039 self.y.add_assign(rhs.y);
1040 self.z.add_assign(rhs.z);
1041 }
1042 }
1043
1044 impl AddAssign<&U16Vec3> for U16Vec3 {
1045 #[inline]
add_assign(&mut self, rhs: &U16Vec3)1046 fn add_assign(&mut self, rhs: &U16Vec3) {
1047 self.add_assign(*rhs)
1048 }
1049 }
1050
1051 impl Add<u16> for U16Vec3 {
1052 type Output = Self;
1053 #[inline]
add(self, rhs: u16) -> Self1054 fn add(self, rhs: u16) -> Self {
1055 Self {
1056 x: self.x.add(rhs),
1057 y: self.y.add(rhs),
1058 z: self.z.add(rhs),
1059 }
1060 }
1061 }
1062
1063 impl Add<&u16> for U16Vec3 {
1064 type Output = U16Vec3;
1065 #[inline]
add(self, rhs: &u16) -> U16Vec31066 fn add(self, rhs: &u16) -> U16Vec3 {
1067 self.add(*rhs)
1068 }
1069 }
1070
1071 impl Add<&u16> for &U16Vec3 {
1072 type Output = U16Vec3;
1073 #[inline]
add(self, rhs: &u16) -> U16Vec31074 fn add(self, rhs: &u16) -> U16Vec3 {
1075 (*self).add(*rhs)
1076 }
1077 }
1078
1079 impl Add<u16> for &U16Vec3 {
1080 type Output = U16Vec3;
1081 #[inline]
add(self, rhs: u16) -> U16Vec31082 fn add(self, rhs: u16) -> U16Vec3 {
1083 (*self).add(rhs)
1084 }
1085 }
1086
1087 impl AddAssign<u16> for U16Vec3 {
1088 #[inline]
add_assign(&mut self, rhs: u16)1089 fn add_assign(&mut self, rhs: u16) {
1090 self.x.add_assign(rhs);
1091 self.y.add_assign(rhs);
1092 self.z.add_assign(rhs);
1093 }
1094 }
1095
1096 impl AddAssign<&u16> for U16Vec3 {
1097 #[inline]
add_assign(&mut self, rhs: &u16)1098 fn add_assign(&mut self, rhs: &u16) {
1099 self.add_assign(*rhs)
1100 }
1101 }
1102
1103 impl Add<U16Vec3> for u16 {
1104 type Output = U16Vec3;
1105 #[inline]
add(self, rhs: U16Vec3) -> U16Vec31106 fn add(self, rhs: U16Vec3) -> U16Vec3 {
1107 U16Vec3 {
1108 x: self.add(rhs.x),
1109 y: self.add(rhs.y),
1110 z: self.add(rhs.z),
1111 }
1112 }
1113 }
1114
1115 impl Add<&U16Vec3> for u16 {
1116 type Output = U16Vec3;
1117 #[inline]
add(self, rhs: &U16Vec3) -> U16Vec31118 fn add(self, rhs: &U16Vec3) -> U16Vec3 {
1119 self.add(*rhs)
1120 }
1121 }
1122
1123 impl Add<&U16Vec3> for &u16 {
1124 type Output = U16Vec3;
1125 #[inline]
add(self, rhs: &U16Vec3) -> U16Vec31126 fn add(self, rhs: &U16Vec3) -> U16Vec3 {
1127 (*self).add(*rhs)
1128 }
1129 }
1130
1131 impl Add<U16Vec3> for &u16 {
1132 type Output = U16Vec3;
1133 #[inline]
add(self, rhs: U16Vec3) -> U16Vec31134 fn add(self, rhs: U16Vec3) -> U16Vec3 {
1135 (*self).add(rhs)
1136 }
1137 }
1138
1139 impl Sub<U16Vec3> for U16Vec3 {
1140 type Output = Self;
1141 #[inline]
sub(self, rhs: Self) -> Self1142 fn sub(self, rhs: Self) -> Self {
1143 Self {
1144 x: self.x.sub(rhs.x),
1145 y: self.y.sub(rhs.y),
1146 z: self.z.sub(rhs.z),
1147 }
1148 }
1149 }
1150
1151 impl Sub<&U16Vec3> for U16Vec3 {
1152 type Output = U16Vec3;
1153 #[inline]
sub(self, rhs: &U16Vec3) -> U16Vec31154 fn sub(self, rhs: &U16Vec3) -> U16Vec3 {
1155 self.sub(*rhs)
1156 }
1157 }
1158
1159 impl Sub<&U16Vec3> for &U16Vec3 {
1160 type Output = U16Vec3;
1161 #[inline]
sub(self, rhs: &U16Vec3) -> U16Vec31162 fn sub(self, rhs: &U16Vec3) -> U16Vec3 {
1163 (*self).sub(*rhs)
1164 }
1165 }
1166
1167 impl Sub<U16Vec3> for &U16Vec3 {
1168 type Output = U16Vec3;
1169 #[inline]
sub(self, rhs: U16Vec3) -> U16Vec31170 fn sub(self, rhs: U16Vec3) -> U16Vec3 {
1171 (*self).sub(rhs)
1172 }
1173 }
1174
1175 impl SubAssign<U16Vec3> for U16Vec3 {
1176 #[inline]
sub_assign(&mut self, rhs: U16Vec3)1177 fn sub_assign(&mut self, rhs: U16Vec3) {
1178 self.x.sub_assign(rhs.x);
1179 self.y.sub_assign(rhs.y);
1180 self.z.sub_assign(rhs.z);
1181 }
1182 }
1183
1184 impl SubAssign<&U16Vec3> for U16Vec3 {
1185 #[inline]
sub_assign(&mut self, rhs: &U16Vec3)1186 fn sub_assign(&mut self, rhs: &U16Vec3) {
1187 self.sub_assign(*rhs)
1188 }
1189 }
1190
1191 impl Sub<u16> for U16Vec3 {
1192 type Output = Self;
1193 #[inline]
sub(self, rhs: u16) -> Self1194 fn sub(self, rhs: u16) -> Self {
1195 Self {
1196 x: self.x.sub(rhs),
1197 y: self.y.sub(rhs),
1198 z: self.z.sub(rhs),
1199 }
1200 }
1201 }
1202
1203 impl Sub<&u16> for U16Vec3 {
1204 type Output = U16Vec3;
1205 #[inline]
sub(self, rhs: &u16) -> U16Vec31206 fn sub(self, rhs: &u16) -> U16Vec3 {
1207 self.sub(*rhs)
1208 }
1209 }
1210
1211 impl Sub<&u16> for &U16Vec3 {
1212 type Output = U16Vec3;
1213 #[inline]
sub(self, rhs: &u16) -> U16Vec31214 fn sub(self, rhs: &u16) -> U16Vec3 {
1215 (*self).sub(*rhs)
1216 }
1217 }
1218
1219 impl Sub<u16> for &U16Vec3 {
1220 type Output = U16Vec3;
1221 #[inline]
sub(self, rhs: u16) -> U16Vec31222 fn sub(self, rhs: u16) -> U16Vec3 {
1223 (*self).sub(rhs)
1224 }
1225 }
1226
1227 impl SubAssign<u16> for U16Vec3 {
1228 #[inline]
sub_assign(&mut self, rhs: u16)1229 fn sub_assign(&mut self, rhs: u16) {
1230 self.x.sub_assign(rhs);
1231 self.y.sub_assign(rhs);
1232 self.z.sub_assign(rhs);
1233 }
1234 }
1235
1236 impl SubAssign<&u16> for U16Vec3 {
1237 #[inline]
sub_assign(&mut self, rhs: &u16)1238 fn sub_assign(&mut self, rhs: &u16) {
1239 self.sub_assign(*rhs)
1240 }
1241 }
1242
1243 impl Sub<U16Vec3> for u16 {
1244 type Output = U16Vec3;
1245 #[inline]
sub(self, rhs: U16Vec3) -> U16Vec31246 fn sub(self, rhs: U16Vec3) -> U16Vec3 {
1247 U16Vec3 {
1248 x: self.sub(rhs.x),
1249 y: self.sub(rhs.y),
1250 z: self.sub(rhs.z),
1251 }
1252 }
1253 }
1254
1255 impl Sub<&U16Vec3> for u16 {
1256 type Output = U16Vec3;
1257 #[inline]
sub(self, rhs: &U16Vec3) -> U16Vec31258 fn sub(self, rhs: &U16Vec3) -> U16Vec3 {
1259 self.sub(*rhs)
1260 }
1261 }
1262
1263 impl Sub<&U16Vec3> for &u16 {
1264 type Output = U16Vec3;
1265 #[inline]
sub(self, rhs: &U16Vec3) -> U16Vec31266 fn sub(self, rhs: &U16Vec3) -> U16Vec3 {
1267 (*self).sub(*rhs)
1268 }
1269 }
1270
1271 impl Sub<U16Vec3> for &u16 {
1272 type Output = U16Vec3;
1273 #[inline]
sub(self, rhs: U16Vec3) -> U16Vec31274 fn sub(self, rhs: U16Vec3) -> U16Vec3 {
1275 (*self).sub(rhs)
1276 }
1277 }
1278
1279 impl Rem<U16Vec3> for U16Vec3 {
1280 type Output = Self;
1281 #[inline]
rem(self, rhs: Self) -> Self1282 fn rem(self, rhs: Self) -> Self {
1283 Self {
1284 x: self.x.rem(rhs.x),
1285 y: self.y.rem(rhs.y),
1286 z: self.z.rem(rhs.z),
1287 }
1288 }
1289 }
1290
1291 impl Rem<&U16Vec3> for U16Vec3 {
1292 type Output = U16Vec3;
1293 #[inline]
rem(self, rhs: &U16Vec3) -> U16Vec31294 fn rem(self, rhs: &U16Vec3) -> U16Vec3 {
1295 self.rem(*rhs)
1296 }
1297 }
1298
1299 impl Rem<&U16Vec3> for &U16Vec3 {
1300 type Output = U16Vec3;
1301 #[inline]
rem(self, rhs: &U16Vec3) -> U16Vec31302 fn rem(self, rhs: &U16Vec3) -> U16Vec3 {
1303 (*self).rem(*rhs)
1304 }
1305 }
1306
1307 impl Rem<U16Vec3> for &U16Vec3 {
1308 type Output = U16Vec3;
1309 #[inline]
rem(self, rhs: U16Vec3) -> U16Vec31310 fn rem(self, rhs: U16Vec3) -> U16Vec3 {
1311 (*self).rem(rhs)
1312 }
1313 }
1314
1315 impl RemAssign<U16Vec3> for U16Vec3 {
1316 #[inline]
rem_assign(&mut self, rhs: Self)1317 fn rem_assign(&mut self, rhs: Self) {
1318 self.x.rem_assign(rhs.x);
1319 self.y.rem_assign(rhs.y);
1320 self.z.rem_assign(rhs.z);
1321 }
1322 }
1323
1324 impl RemAssign<&U16Vec3> for U16Vec3 {
1325 #[inline]
rem_assign(&mut self, rhs: &U16Vec3)1326 fn rem_assign(&mut self, rhs: &U16Vec3) {
1327 self.rem_assign(*rhs)
1328 }
1329 }
1330
1331 impl Rem<u16> for U16Vec3 {
1332 type Output = Self;
1333 #[inline]
rem(self, rhs: u16) -> Self1334 fn rem(self, rhs: u16) -> Self {
1335 Self {
1336 x: self.x.rem(rhs),
1337 y: self.y.rem(rhs),
1338 z: self.z.rem(rhs),
1339 }
1340 }
1341 }
1342
1343 impl Rem<&u16> for U16Vec3 {
1344 type Output = U16Vec3;
1345 #[inline]
rem(self, rhs: &u16) -> U16Vec31346 fn rem(self, rhs: &u16) -> U16Vec3 {
1347 self.rem(*rhs)
1348 }
1349 }
1350
1351 impl Rem<&u16> for &U16Vec3 {
1352 type Output = U16Vec3;
1353 #[inline]
rem(self, rhs: &u16) -> U16Vec31354 fn rem(self, rhs: &u16) -> U16Vec3 {
1355 (*self).rem(*rhs)
1356 }
1357 }
1358
1359 impl Rem<u16> for &U16Vec3 {
1360 type Output = U16Vec3;
1361 #[inline]
rem(self, rhs: u16) -> U16Vec31362 fn rem(self, rhs: u16) -> U16Vec3 {
1363 (*self).rem(rhs)
1364 }
1365 }
1366
1367 impl RemAssign<u16> for U16Vec3 {
1368 #[inline]
rem_assign(&mut self, rhs: u16)1369 fn rem_assign(&mut self, rhs: u16) {
1370 self.x.rem_assign(rhs);
1371 self.y.rem_assign(rhs);
1372 self.z.rem_assign(rhs);
1373 }
1374 }
1375
1376 impl RemAssign<&u16> for U16Vec3 {
1377 #[inline]
rem_assign(&mut self, rhs: &u16)1378 fn rem_assign(&mut self, rhs: &u16) {
1379 self.rem_assign(*rhs)
1380 }
1381 }
1382
1383 impl Rem<U16Vec3> for u16 {
1384 type Output = U16Vec3;
1385 #[inline]
rem(self, rhs: U16Vec3) -> U16Vec31386 fn rem(self, rhs: U16Vec3) -> U16Vec3 {
1387 U16Vec3 {
1388 x: self.rem(rhs.x),
1389 y: self.rem(rhs.y),
1390 z: self.rem(rhs.z),
1391 }
1392 }
1393 }
1394
1395 impl Rem<&U16Vec3> for u16 {
1396 type Output = U16Vec3;
1397 #[inline]
rem(self, rhs: &U16Vec3) -> U16Vec31398 fn rem(self, rhs: &U16Vec3) -> U16Vec3 {
1399 self.rem(*rhs)
1400 }
1401 }
1402
1403 impl Rem<&U16Vec3> for &u16 {
1404 type Output = U16Vec3;
1405 #[inline]
rem(self, rhs: &U16Vec3) -> U16Vec31406 fn rem(self, rhs: &U16Vec3) -> U16Vec3 {
1407 (*self).rem(*rhs)
1408 }
1409 }
1410
1411 impl Rem<U16Vec3> for &u16 {
1412 type Output = U16Vec3;
1413 #[inline]
rem(self, rhs: U16Vec3) -> U16Vec31414 fn rem(self, rhs: U16Vec3) -> U16Vec3 {
1415 (*self).rem(rhs)
1416 }
1417 }
1418
1419 #[cfg(not(target_arch = "spirv"))]
1420 impl AsRef<[u16; 3]> for U16Vec3 {
1421 #[inline]
as_ref(&self) -> &[u16; 3]1422 fn as_ref(&self) -> &[u16; 3] {
1423 unsafe { &*(self as *const U16Vec3 as *const [u16; 3]) }
1424 }
1425 }
1426
1427 #[cfg(not(target_arch = "spirv"))]
1428 impl AsMut<[u16; 3]> for U16Vec3 {
1429 #[inline]
as_mut(&mut self) -> &mut [u16; 3]1430 fn as_mut(&mut self) -> &mut [u16; 3] {
1431 unsafe { &mut *(self as *mut U16Vec3 as *mut [u16; 3]) }
1432 }
1433 }
1434
1435 impl Sum for U16Vec3 {
1436 #[inline]
sum<I>(iter: I) -> Self where I: Iterator<Item = Self>,1437 fn sum<I>(iter: I) -> Self
1438 where
1439 I: Iterator<Item = Self>,
1440 {
1441 iter.fold(Self::ZERO, Self::add)
1442 }
1443 }
1444
1445 impl<'a> Sum<&'a Self> for U16Vec3 {
1446 #[inline]
sum<I>(iter: I) -> Self where I: Iterator<Item = &'a Self>,1447 fn sum<I>(iter: I) -> Self
1448 where
1449 I: Iterator<Item = &'a Self>,
1450 {
1451 iter.fold(Self::ZERO, |a, &b| Self::add(a, b))
1452 }
1453 }
1454
1455 impl Product for U16Vec3 {
1456 #[inline]
product<I>(iter: I) -> Self where I: Iterator<Item = Self>,1457 fn product<I>(iter: I) -> Self
1458 where
1459 I: Iterator<Item = Self>,
1460 {
1461 iter.fold(Self::ONE, Self::mul)
1462 }
1463 }
1464
1465 impl<'a> Product<&'a Self> for U16Vec3 {
1466 #[inline]
product<I>(iter: I) -> Self where I: Iterator<Item = &'a Self>,1467 fn product<I>(iter: I) -> Self
1468 where
1469 I: Iterator<Item = &'a Self>,
1470 {
1471 iter.fold(Self::ONE, |a, &b| Self::mul(a, b))
1472 }
1473 }
1474
1475 impl Not for U16Vec3 {
1476 type Output = Self;
1477 #[inline]
not(self) -> Self::Output1478 fn not(self) -> Self::Output {
1479 Self {
1480 x: self.x.not(),
1481 y: self.y.not(),
1482 z: self.z.not(),
1483 }
1484 }
1485 }
1486
1487 impl BitAnd for U16Vec3 {
1488 type Output = Self;
1489 #[inline]
bitand(self, rhs: Self) -> Self::Output1490 fn bitand(self, rhs: Self) -> Self::Output {
1491 Self {
1492 x: self.x.bitand(rhs.x),
1493 y: self.y.bitand(rhs.y),
1494 z: self.z.bitand(rhs.z),
1495 }
1496 }
1497 }
1498
1499 impl BitOr for U16Vec3 {
1500 type Output = Self;
1501 #[inline]
bitor(self, rhs: Self) -> Self::Output1502 fn bitor(self, rhs: Self) -> Self::Output {
1503 Self {
1504 x: self.x.bitor(rhs.x),
1505 y: self.y.bitor(rhs.y),
1506 z: self.z.bitor(rhs.z),
1507 }
1508 }
1509 }
1510
1511 impl BitXor for U16Vec3 {
1512 type Output = Self;
1513 #[inline]
bitxor(self, rhs: Self) -> Self::Output1514 fn bitxor(self, rhs: Self) -> Self::Output {
1515 Self {
1516 x: self.x.bitxor(rhs.x),
1517 y: self.y.bitxor(rhs.y),
1518 z: self.z.bitxor(rhs.z),
1519 }
1520 }
1521 }
1522
1523 impl BitAnd<u16> for U16Vec3 {
1524 type Output = Self;
1525 #[inline]
bitand(self, rhs: u16) -> Self::Output1526 fn bitand(self, rhs: u16) -> Self::Output {
1527 Self {
1528 x: self.x.bitand(rhs),
1529 y: self.y.bitand(rhs),
1530 z: self.z.bitand(rhs),
1531 }
1532 }
1533 }
1534
1535 impl BitOr<u16> for U16Vec3 {
1536 type Output = Self;
1537 #[inline]
bitor(self, rhs: u16) -> Self::Output1538 fn bitor(self, rhs: u16) -> Self::Output {
1539 Self {
1540 x: self.x.bitor(rhs),
1541 y: self.y.bitor(rhs),
1542 z: self.z.bitor(rhs),
1543 }
1544 }
1545 }
1546
1547 impl BitXor<u16> for U16Vec3 {
1548 type Output = Self;
1549 #[inline]
bitxor(self, rhs: u16) -> Self::Output1550 fn bitxor(self, rhs: u16) -> Self::Output {
1551 Self {
1552 x: self.x.bitxor(rhs),
1553 y: self.y.bitxor(rhs),
1554 z: self.z.bitxor(rhs),
1555 }
1556 }
1557 }
1558
1559 impl Shl<i8> for U16Vec3 {
1560 type Output = Self;
1561 #[inline]
shl(self, rhs: i8) -> Self::Output1562 fn shl(self, rhs: i8) -> Self::Output {
1563 Self {
1564 x: self.x.shl(rhs),
1565 y: self.y.shl(rhs),
1566 z: self.z.shl(rhs),
1567 }
1568 }
1569 }
1570
1571 impl Shr<i8> for U16Vec3 {
1572 type Output = Self;
1573 #[inline]
shr(self, rhs: i8) -> Self::Output1574 fn shr(self, rhs: i8) -> Self::Output {
1575 Self {
1576 x: self.x.shr(rhs),
1577 y: self.y.shr(rhs),
1578 z: self.z.shr(rhs),
1579 }
1580 }
1581 }
1582
1583 impl Shl<i16> for U16Vec3 {
1584 type Output = Self;
1585 #[inline]
shl(self, rhs: i16) -> Self::Output1586 fn shl(self, rhs: i16) -> Self::Output {
1587 Self {
1588 x: self.x.shl(rhs),
1589 y: self.y.shl(rhs),
1590 z: self.z.shl(rhs),
1591 }
1592 }
1593 }
1594
1595 impl Shr<i16> for U16Vec3 {
1596 type Output = Self;
1597 #[inline]
shr(self, rhs: i16) -> Self::Output1598 fn shr(self, rhs: i16) -> Self::Output {
1599 Self {
1600 x: self.x.shr(rhs),
1601 y: self.y.shr(rhs),
1602 z: self.z.shr(rhs),
1603 }
1604 }
1605 }
1606
1607 impl Shl<i32> for U16Vec3 {
1608 type Output = Self;
1609 #[inline]
shl(self, rhs: i32) -> Self::Output1610 fn shl(self, rhs: i32) -> Self::Output {
1611 Self {
1612 x: self.x.shl(rhs),
1613 y: self.y.shl(rhs),
1614 z: self.z.shl(rhs),
1615 }
1616 }
1617 }
1618
1619 impl Shr<i32> for U16Vec3 {
1620 type Output = Self;
1621 #[inline]
shr(self, rhs: i32) -> Self::Output1622 fn shr(self, rhs: i32) -> Self::Output {
1623 Self {
1624 x: self.x.shr(rhs),
1625 y: self.y.shr(rhs),
1626 z: self.z.shr(rhs),
1627 }
1628 }
1629 }
1630
1631 impl Shl<i64> for U16Vec3 {
1632 type Output = Self;
1633 #[inline]
shl(self, rhs: i64) -> Self::Output1634 fn shl(self, rhs: i64) -> Self::Output {
1635 Self {
1636 x: self.x.shl(rhs),
1637 y: self.y.shl(rhs),
1638 z: self.z.shl(rhs),
1639 }
1640 }
1641 }
1642
1643 impl Shr<i64> for U16Vec3 {
1644 type Output = Self;
1645 #[inline]
shr(self, rhs: i64) -> Self::Output1646 fn shr(self, rhs: i64) -> Self::Output {
1647 Self {
1648 x: self.x.shr(rhs),
1649 y: self.y.shr(rhs),
1650 z: self.z.shr(rhs),
1651 }
1652 }
1653 }
1654
1655 impl Shl<u8> for U16Vec3 {
1656 type Output = Self;
1657 #[inline]
shl(self, rhs: u8) -> Self::Output1658 fn shl(self, rhs: u8) -> Self::Output {
1659 Self {
1660 x: self.x.shl(rhs),
1661 y: self.y.shl(rhs),
1662 z: self.z.shl(rhs),
1663 }
1664 }
1665 }
1666
1667 impl Shr<u8> for U16Vec3 {
1668 type Output = Self;
1669 #[inline]
shr(self, rhs: u8) -> Self::Output1670 fn shr(self, rhs: u8) -> Self::Output {
1671 Self {
1672 x: self.x.shr(rhs),
1673 y: self.y.shr(rhs),
1674 z: self.z.shr(rhs),
1675 }
1676 }
1677 }
1678
1679 impl Shl<u16> for U16Vec3 {
1680 type Output = Self;
1681 #[inline]
shl(self, rhs: u16) -> Self::Output1682 fn shl(self, rhs: u16) -> Self::Output {
1683 Self {
1684 x: self.x.shl(rhs),
1685 y: self.y.shl(rhs),
1686 z: self.z.shl(rhs),
1687 }
1688 }
1689 }
1690
1691 impl Shr<u16> for U16Vec3 {
1692 type Output = Self;
1693 #[inline]
shr(self, rhs: u16) -> Self::Output1694 fn shr(self, rhs: u16) -> Self::Output {
1695 Self {
1696 x: self.x.shr(rhs),
1697 y: self.y.shr(rhs),
1698 z: self.z.shr(rhs),
1699 }
1700 }
1701 }
1702
1703 impl Shl<u32> for U16Vec3 {
1704 type Output = Self;
1705 #[inline]
shl(self, rhs: u32) -> Self::Output1706 fn shl(self, rhs: u32) -> Self::Output {
1707 Self {
1708 x: self.x.shl(rhs),
1709 y: self.y.shl(rhs),
1710 z: self.z.shl(rhs),
1711 }
1712 }
1713 }
1714
1715 impl Shr<u32> for U16Vec3 {
1716 type Output = Self;
1717 #[inline]
shr(self, rhs: u32) -> Self::Output1718 fn shr(self, rhs: u32) -> Self::Output {
1719 Self {
1720 x: self.x.shr(rhs),
1721 y: self.y.shr(rhs),
1722 z: self.z.shr(rhs),
1723 }
1724 }
1725 }
1726
1727 impl Shl<u64> for U16Vec3 {
1728 type Output = Self;
1729 #[inline]
shl(self, rhs: u64) -> Self::Output1730 fn shl(self, rhs: u64) -> Self::Output {
1731 Self {
1732 x: self.x.shl(rhs),
1733 y: self.y.shl(rhs),
1734 z: self.z.shl(rhs),
1735 }
1736 }
1737 }
1738
1739 impl Shr<u64> for U16Vec3 {
1740 type Output = Self;
1741 #[inline]
shr(self, rhs: u64) -> Self::Output1742 fn shr(self, rhs: u64) -> Self::Output {
1743 Self {
1744 x: self.x.shr(rhs),
1745 y: self.y.shr(rhs),
1746 z: self.z.shr(rhs),
1747 }
1748 }
1749 }
1750
1751 impl Shl<crate::IVec3> for U16Vec3 {
1752 type Output = Self;
1753 #[inline]
shl(self, rhs: crate::IVec3) -> Self::Output1754 fn shl(self, rhs: crate::IVec3) -> Self::Output {
1755 Self {
1756 x: self.x.shl(rhs.x),
1757 y: self.y.shl(rhs.y),
1758 z: self.z.shl(rhs.z),
1759 }
1760 }
1761 }
1762
1763 impl Shr<crate::IVec3> for U16Vec3 {
1764 type Output = Self;
1765 #[inline]
shr(self, rhs: crate::IVec3) -> Self::Output1766 fn shr(self, rhs: crate::IVec3) -> Self::Output {
1767 Self {
1768 x: self.x.shr(rhs.x),
1769 y: self.y.shr(rhs.y),
1770 z: self.z.shr(rhs.z),
1771 }
1772 }
1773 }
1774
1775 impl Shl<crate::UVec3> for U16Vec3 {
1776 type Output = Self;
1777 #[inline]
shl(self, rhs: crate::UVec3) -> Self::Output1778 fn shl(self, rhs: crate::UVec3) -> Self::Output {
1779 Self {
1780 x: self.x.shl(rhs.x),
1781 y: self.y.shl(rhs.y),
1782 z: self.z.shl(rhs.z),
1783 }
1784 }
1785 }
1786
1787 impl Shr<crate::UVec3> for U16Vec3 {
1788 type Output = Self;
1789 #[inline]
shr(self, rhs: crate::UVec3) -> Self::Output1790 fn shr(self, rhs: crate::UVec3) -> Self::Output {
1791 Self {
1792 x: self.x.shr(rhs.x),
1793 y: self.y.shr(rhs.y),
1794 z: self.z.shr(rhs.z),
1795 }
1796 }
1797 }
1798
1799 impl Index<usize> for U16Vec3 {
1800 type Output = u16;
1801 #[inline]
index(&self, index: usize) -> &Self::Output1802 fn index(&self, index: usize) -> &Self::Output {
1803 match index {
1804 0 => &self.x,
1805 1 => &self.y,
1806 2 => &self.z,
1807 _ => panic!("index out of bounds"),
1808 }
1809 }
1810 }
1811
1812 impl IndexMut<usize> for U16Vec3 {
1813 #[inline]
index_mut(&mut self, index: usize) -> &mut Self::Output1814 fn index_mut(&mut self, index: usize) -> &mut Self::Output {
1815 match index {
1816 0 => &mut self.x,
1817 1 => &mut self.y,
1818 2 => &mut self.z,
1819 _ => panic!("index out of bounds"),
1820 }
1821 }
1822 }
1823
1824 impl fmt::Display for U16Vec3 {
fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result1825 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1826 write!(f, "[{}, {}, {}]", self.x, self.y, self.z)
1827 }
1828 }
1829
1830 impl fmt::Debug for U16Vec3 {
fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result1831 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
1832 fmt.debug_tuple(stringify!(U16Vec3))
1833 .field(&self.x)
1834 .field(&self.y)
1835 .field(&self.z)
1836 .finish()
1837 }
1838 }
1839
1840 impl From<[u16; 3]> for U16Vec3 {
1841 #[inline]
from(a: [u16; 3]) -> Self1842 fn from(a: [u16; 3]) -> Self {
1843 Self::new(a[0], a[1], a[2])
1844 }
1845 }
1846
1847 impl From<U16Vec3> for [u16; 3] {
1848 #[inline]
from(v: U16Vec3) -> Self1849 fn from(v: U16Vec3) -> Self {
1850 [v.x, v.y, v.z]
1851 }
1852 }
1853
1854 impl From<(u16, u16, u16)> for U16Vec3 {
1855 #[inline]
from(t: (u16, u16, u16)) -> Self1856 fn from(t: (u16, u16, u16)) -> Self {
1857 Self::new(t.0, t.1, t.2)
1858 }
1859 }
1860
1861 impl From<U16Vec3> for (u16, u16, u16) {
1862 #[inline]
from(v: U16Vec3) -> Self1863 fn from(v: U16Vec3) -> Self {
1864 (v.x, v.y, v.z)
1865 }
1866 }
1867
1868 impl From<(U16Vec2, u16)> for U16Vec3 {
1869 #[inline]
from((v, z): (U16Vec2, u16)) -> Self1870 fn from((v, z): (U16Vec2, u16)) -> Self {
1871 Self::new(v.x, v.y, z)
1872 }
1873 }
1874
1875 impl From<U8Vec3> for U16Vec3 {
1876 #[inline]
from(v: U8Vec3) -> Self1877 fn from(v: U8Vec3) -> Self {
1878 Self::new(u16::from(v.x), u16::from(v.y), u16::from(v.z))
1879 }
1880 }
1881
1882 impl TryFrom<I8Vec3> for U16Vec3 {
1883 type Error = core::num::TryFromIntError;
1884
1885 #[inline]
try_from(v: I8Vec3) -> Result<Self, Self::Error>1886 fn try_from(v: I8Vec3) -> Result<Self, Self::Error> {
1887 Ok(Self::new(
1888 u16::try_from(v.x)?,
1889 u16::try_from(v.y)?,
1890 u16::try_from(v.z)?,
1891 ))
1892 }
1893 }
1894
1895 impl TryFrom<I16Vec3> for U16Vec3 {
1896 type Error = core::num::TryFromIntError;
1897
1898 #[inline]
try_from(v: I16Vec3) -> Result<Self, Self::Error>1899 fn try_from(v: I16Vec3) -> Result<Self, Self::Error> {
1900 Ok(Self::new(
1901 u16::try_from(v.x)?,
1902 u16::try_from(v.y)?,
1903 u16::try_from(v.z)?,
1904 ))
1905 }
1906 }
1907
1908 impl TryFrom<IVec3> for U16Vec3 {
1909 type Error = core::num::TryFromIntError;
1910
1911 #[inline]
try_from(v: IVec3) -> Result<Self, Self::Error>1912 fn try_from(v: IVec3) -> Result<Self, Self::Error> {
1913 Ok(Self::new(
1914 u16::try_from(v.x)?,
1915 u16::try_from(v.y)?,
1916 u16::try_from(v.z)?,
1917 ))
1918 }
1919 }
1920
1921 impl TryFrom<UVec3> for U16Vec3 {
1922 type Error = core::num::TryFromIntError;
1923
1924 #[inline]
try_from(v: UVec3) -> Result<Self, Self::Error>1925 fn try_from(v: UVec3) -> Result<Self, Self::Error> {
1926 Ok(Self::new(
1927 u16::try_from(v.x)?,
1928 u16::try_from(v.y)?,
1929 u16::try_from(v.z)?,
1930 ))
1931 }
1932 }
1933
1934 impl TryFrom<I64Vec3> for U16Vec3 {
1935 type Error = core::num::TryFromIntError;
1936
1937 #[inline]
try_from(v: I64Vec3) -> Result<Self, Self::Error>1938 fn try_from(v: I64Vec3) -> Result<Self, Self::Error> {
1939 Ok(Self::new(
1940 u16::try_from(v.x)?,
1941 u16::try_from(v.y)?,
1942 u16::try_from(v.z)?,
1943 ))
1944 }
1945 }
1946
1947 impl TryFrom<U64Vec3> for U16Vec3 {
1948 type Error = core::num::TryFromIntError;
1949
1950 #[inline]
try_from(v: U64Vec3) -> Result<Self, Self::Error>1951 fn try_from(v: U64Vec3) -> Result<Self, Self::Error> {
1952 Ok(Self::new(
1953 u16::try_from(v.x)?,
1954 u16::try_from(v.y)?,
1955 u16::try_from(v.z)?,
1956 ))
1957 }
1958 }
1959
1960 impl From<BVec3> for U16Vec3 {
1961 #[inline]
from(v: BVec3) -> Self1962 fn from(v: BVec3) -> Self {
1963 Self::new(u16::from(v.x), u16::from(v.y), u16::from(v.z))
1964 }
1965 }
1966
1967 impl From<BVec3A> for U16Vec3 {
1968 #[inline]
from(v: BVec3A) -> Self1969 fn from(v: BVec3A) -> Self {
1970 let bool_array: [bool; 3] = v.into();
1971 Self::new(
1972 u16::from(bool_array[0]),
1973 u16::from(bool_array[1]),
1974 u16::from(bool_array[2]),
1975 )
1976 }
1977 }
1978