diff --git a/codegen/templates/vec_mask.rs.tera b/codegen/templates/vec_mask.rs.tera index a604ea68..c89d3250 100644 --- a/codegen/templates/vec_mask.rs.tera +++ b/codegen/templates/vec_mask.rs.tera @@ -71,13 +71,12 @@ pub struct {{ self_t }}(pub(crate) {{ simd_t }}); const MASK: [u32; 2] = [0, 0xff_ff_ff_ff]; -const FALSE: {{ self_t }} = {{ self_t }}::new( - {% for c in components %} - false, - {%- endfor %} -); - impl {{ self_t }} { + /// All false. + pub const FALSE: Self = Self::splat(false); + + /// All true. + pub const TRUE: Self = Self::splat(true); /// Creates a new vector mask. #[inline(always)] @@ -276,7 +275,7 @@ impl {{ self_t }} { impl Default for {{ self_t }} { #[inline] fn default() -> Self { - FALSE + Self::FALSE } } diff --git a/src/bool/bvec2.rs b/src/bool/bvec2.rs index d5f2405e..e69fcfce 100644 --- a/src/bool/bvec2.rs +++ b/src/bool/bvec2.rs @@ -14,9 +14,13 @@ pub struct BVec2 { const MASK: [u32; 2] = [0, 0xff_ff_ff_ff]; -const FALSE: BVec2 = BVec2::new(false, false); - impl BVec2 { + /// All false. + pub const FALSE: Self = Self::splat(false); + + /// All true. + pub const TRUE: Self = Self::splat(true); + /// Creates a new vector mask. #[inline(always)] pub const fn new(x: bool, y: bool) -> Self { @@ -64,7 +68,7 @@ impl BVec2 { impl Default for BVec2 { #[inline] fn default() -> Self { - FALSE + Self::FALSE } } diff --git a/src/bool/bvec3.rs b/src/bool/bvec3.rs index 171fbf9a..91331e24 100644 --- a/src/bool/bvec3.rs +++ b/src/bool/bvec3.rs @@ -15,9 +15,13 @@ pub struct BVec3 { const MASK: [u32; 2] = [0, 0xff_ff_ff_ff]; -const FALSE: BVec3 = BVec3::new(false, false, false); - impl BVec3 { + /// All false. + pub const FALSE: Self = Self::splat(false); + + /// All true. + pub const TRUE: Self = Self::splat(true); + /// Creates a new vector mask. #[inline(always)] pub const fn new(x: bool, y: bool, z: bool) -> Self { @@ -69,7 +73,7 @@ impl BVec3 { impl Default for BVec3 { #[inline] fn default() -> Self { - FALSE + Self::FALSE } } diff --git a/src/bool/bvec4.rs b/src/bool/bvec4.rs index 5cedba14..7754cd47 100644 --- a/src/bool/bvec4.rs +++ b/src/bool/bvec4.rs @@ -16,9 +16,13 @@ pub struct BVec4 { const MASK: [u32; 2] = [0, 0xff_ff_ff_ff]; -const FALSE: BVec4 = BVec4::new(false, false, false, false); - impl BVec4 { + /// All false. + pub const FALSE: Self = Self::splat(false); + + /// All true. + pub const TRUE: Self = Self::splat(true); + /// Creates a new vector mask. #[inline(always)] pub const fn new(x: bool, y: bool, z: bool, w: bool) -> Self { @@ -71,7 +75,7 @@ impl BVec4 { impl Default for BVec4 { #[inline] fn default() -> Self { - FALSE + Self::FALSE } } diff --git a/src/bool/coresimd/bvec3a.rs b/src/bool/coresimd/bvec3a.rs index 474172bc..79f3a575 100644 --- a/src/bool/coresimd/bvec3a.rs +++ b/src/bool/coresimd/bvec3a.rs @@ -21,9 +21,13 @@ pub struct BVec3A(pub(crate) mask32x4); const MASK: [u32; 2] = [0, 0xff_ff_ff_ff]; -const FALSE: BVec3A = BVec3A::new(false, false, false); - impl BVec3A { + /// All false. + pub const FALSE: Self = Self::splat(false); + + /// All true. + pub const TRUE: Self = Self::splat(true); + /// Creates a new vector mask. #[inline(always)] pub const fn new(x: bool, y: bool, z: bool) -> Self { @@ -82,7 +86,7 @@ impl BVec3A { impl Default for BVec3A { #[inline] fn default() -> Self { - FALSE + Self::FALSE } } diff --git a/src/bool/coresimd/bvec4a.rs b/src/bool/coresimd/bvec4a.rs index 3bc0ee78..381ee0b3 100644 --- a/src/bool/coresimd/bvec4a.rs +++ b/src/bool/coresimd/bvec4a.rs @@ -21,9 +21,13 @@ pub struct BVec4A(pub(crate) mask32x4); const MASK: [u32; 2] = [0, 0xff_ff_ff_ff]; -const FALSE: BVec4A = BVec4A::new(false, false, false, false); - impl BVec4A { + /// All false. + pub const FALSE: Self = Self::splat(false); + + /// All true. + pub const TRUE: Self = Self::splat(true); + /// Creates a new vector mask. #[inline(always)] pub const fn new(x: bool, y: bool, z: bool, w: bool) -> Self { @@ -93,7 +97,7 @@ impl BVec4A { impl Default for BVec4A { #[inline] fn default() -> Self { - FALSE + Self::FALSE } } diff --git a/src/bool/scalar/bvec3a.rs b/src/bool/scalar/bvec3a.rs index b619c060..dbae3951 100644 --- a/src/bool/scalar/bvec3a.rs +++ b/src/bool/scalar/bvec3a.rs @@ -15,9 +15,13 @@ pub struct BVec3A { const MASK: [u32; 2] = [0, 0xff_ff_ff_ff]; -const FALSE: BVec3A = BVec3A::new(false, false, false); - impl BVec3A { + /// All false. + pub const FALSE: Self = Self::splat(false); + + /// All true. + pub const TRUE: Self = Self::splat(true); + /// Creates a new vector mask. #[inline(always)] pub const fn new(x: bool, y: bool, z: bool) -> Self { @@ -73,7 +77,7 @@ impl BVec3A { impl Default for BVec3A { #[inline] fn default() -> Self { - FALSE + Self::FALSE } } diff --git a/src/bool/scalar/bvec4a.rs b/src/bool/scalar/bvec4a.rs index cea52211..c12d127e 100644 --- a/src/bool/scalar/bvec4a.rs +++ b/src/bool/scalar/bvec4a.rs @@ -16,9 +16,13 @@ pub struct BVec4A { const MASK: [u32; 2] = [0, 0xff_ff_ff_ff]; -const FALSE: BVec4A = BVec4A::new(false, false, false, false); - impl BVec4A { + /// All false. + pub const FALSE: Self = Self::splat(false); + + /// All true. + pub const TRUE: Self = Self::splat(true); + /// Creates a new vector mask. #[inline(always)] pub const fn new(x: bool, y: bool, z: bool, w: bool) -> Self { @@ -76,7 +80,7 @@ impl BVec4A { impl Default for BVec4A { #[inline] fn default() -> Self { - FALSE + Self::FALSE } } diff --git a/src/bool/sse2/bvec3a.rs b/src/bool/sse2/bvec3a.rs index 955d6a03..0fdbdf6c 100644 --- a/src/bool/sse2/bvec3a.rs +++ b/src/bool/sse2/bvec3a.rs @@ -24,9 +24,13 @@ pub struct BVec3A(pub(crate) __m128); const MASK: [u32; 2] = [0, 0xff_ff_ff_ff]; -const FALSE: BVec3A = BVec3A::new(false, false, false); - impl BVec3A { + /// All false. + pub const FALSE: Self = Self::splat(false); + + /// All true. + pub const TRUE: Self = Self::splat(true); + /// Creates a new vector mask. #[inline(always)] pub const fn new(x: bool, y: bool, z: bool) -> Self { @@ -85,7 +89,7 @@ impl BVec3A { impl Default for BVec3A { #[inline] fn default() -> Self { - FALSE + Self::FALSE } } diff --git a/src/bool/sse2/bvec4a.rs b/src/bool/sse2/bvec4a.rs index d84f1845..fc9d08c5 100644 --- a/src/bool/sse2/bvec4a.rs +++ b/src/bool/sse2/bvec4a.rs @@ -24,9 +24,13 @@ pub struct BVec4A(pub(crate) __m128); const MASK: [u32; 2] = [0, 0xff_ff_ff_ff]; -const FALSE: BVec4A = BVec4A::new(false, false, false, false); - impl BVec4A { + /// All false. + pub const FALSE: Self = Self::splat(false); + + /// All true. + pub const TRUE: Self = Self::splat(true); + /// Creates a new vector mask. #[inline(always)] pub const fn new(x: bool, y: bool, z: bool, w: bool) -> Self { @@ -96,7 +100,7 @@ impl BVec4A { impl Default for BVec4A { #[inline] fn default() -> Self { - FALSE + Self::FALSE } } diff --git a/src/bool/wasm32/bvec3a.rs b/src/bool/wasm32/bvec3a.rs index 5ff19060..755246ad 100644 --- a/src/bool/wasm32/bvec3a.rs +++ b/src/bool/wasm32/bvec3a.rs @@ -16,9 +16,13 @@ pub struct BVec3A(pub(crate) v128); const MASK: [u32; 2] = [0, 0xff_ff_ff_ff]; -const FALSE: BVec3A = BVec3A::new(false, false, false); - impl BVec3A { + /// All false. + pub const FALSE: Self = Self::splat(false); + + /// All true. + pub const TRUE: Self = Self::splat(true); + /// Creates a new vector mask. #[inline(always)] pub const fn new(x: bool, y: bool, z: bool) -> Self { @@ -77,7 +81,7 @@ impl BVec3A { impl Default for BVec3A { #[inline] fn default() -> Self { - FALSE + Self::FALSE } } diff --git a/src/bool/wasm32/bvec4a.rs b/src/bool/wasm32/bvec4a.rs index d4c5c941..cdec83f3 100644 --- a/src/bool/wasm32/bvec4a.rs +++ b/src/bool/wasm32/bvec4a.rs @@ -16,9 +16,13 @@ pub struct BVec4A(pub(crate) v128); const MASK: [u32; 2] = [0, 0xff_ff_ff_ff]; -const FALSE: BVec4A = BVec4A::new(false, false, false, false); - impl BVec4A { + /// All false. + pub const FALSE: Self = Self::splat(false); + + /// All true. + pub const TRUE: Self = Self::splat(true); + /// Creates a new vector mask. #[inline(always)] pub const fn new(x: bool, y: bool, z: bool, w: bool) -> Self { @@ -83,7 +87,7 @@ impl BVec4A { impl Default for BVec4A { #[inline] fn default() -> Self { - FALSE + Self::FALSE } }