aboutsummaryrefslogtreecommitdiff
path: root/src/bool/bvec3.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bool/bvec3.rs')
-rw-r--r--src/bool/bvec3.rs34
1 files changed, 0 insertions, 34 deletions
diff --git a/src/bool/bvec3.rs b/src/bool/bvec3.rs
index 983cd3f..91331e2 100644
--- a/src/bool/bvec3.rs
+++ b/src/bool/bvec3.rs
@@ -24,14 +24,12 @@ impl BVec3 {
/// Creates a new vector mask.
#[inline(always)]
- #[must_use]
pub const fn new(x: bool, y: bool, z: bool) -> Self {
Self { x, y, z }
}
/// Creates a vector with all elements set to `v`.
#[inline]
- #[must_use]
pub const fn splat(v: bool) -> Self {
Self::new(v, v, v)
}
@@ -41,60 +39,28 @@ impl BVec3 {
/// A true element results in a `1` bit and a false element in a `0` bit. Element `x` goes
/// into the first lowest bit, element `y` into the second, etc.
#[inline]
- #[must_use]
pub fn bitmask(self) -> u32 {
(self.x as u32) | (self.y as u32) << 1 | (self.z as u32) << 2
}
/// Returns true if any of the elements are true, false otherwise.
#[inline]
- #[must_use]
pub fn any(self) -> bool {
self.x || self.y || self.z
}
/// Returns true if all the elements are true, false otherwise.
#[inline]
- #[must_use]
pub fn all(self) -> bool {
self.x && self.y && self.z
}
- /// Tests the value at `index`.
- ///
- /// Panics if `index` is greater than 2.
- #[inline]
- #[must_use]
- pub fn test(&self, index: usize) -> bool {
- match index {
- 0 => self.x,
- 1 => self.y,
- 2 => self.z,
- _ => panic!("index out of bounds"),
- }
- }
-
- /// Sets the element at `index`.
- ///
- /// Panics if `index` is greater than 2.
- #[inline]
- pub fn set(&mut self, index: usize, value: bool) {
- match index {
- 0 => self.x = value,
- 1 => self.y = value,
- 2 => self.z = value,
- _ => panic!("index out of bounds"),
- }
- }
-
#[inline]
- #[must_use]
fn into_bool_array(self) -> [bool; 3] {
[self.x, self.y, self.z]
}
#[inline]
- #[must_use]
fn into_u32_array(self) -> [u32; 3] {
[
MASK[self.x as usize],