diff --git a/crates/core_simd/src/masks.rs b/crates/core_simd/src/masks.rs index b7bde44b384..b433712a329 100644 --- a/crates/core_simd/src/masks.rs +++ b/crates/core_simd/src/masks.rs @@ -452,74 +452,59 @@ where } } -/// A SIMD mask of `LANES` 8-bit values. -pub type Mask8 = Mask; - -/// A SIMD mask of `LANES` 16-bit values. -pub type Mask16 = Mask; - -/// A SIMD mask of `LANES` 32-bit values. -pub type Mask32 = Mask; - -/// A SIMD mask of `LANES` 64-bit values. -pub type Mask64 = Mask; - -/// A SIMD mask of `LANES` pointer-width values. -pub type MaskSize = Mask; - /// Vector of eight 8-bit masks -pub type mask8x8 = Mask8<8>; +pub type mask8x8 = Mask; /// Vector of 16 8-bit masks -pub type mask8x16 = Mask8<16>; +pub type mask8x16 = Mask; /// Vector of 32 8-bit masks -pub type mask8x32 = Mask8<32>; +pub type mask8x32 = Mask; /// Vector of 16 8-bit masks -pub type mask8x64 = Mask8<64>; +pub type mask8x64 = Mask; /// Vector of four 16-bit masks -pub type mask16x4 = Mask16<4>; +pub type mask16x4 = Mask; /// Vector of eight 16-bit masks -pub type mask16x8 = Mask16<8>; +pub type mask16x8 = Mask; /// Vector of 16 16-bit masks -pub type mask16x16 = Mask16<16>; +pub type mask16x16 = Mask; /// Vector of 32 16-bit masks -pub type mask16x32 = Mask32<32>; +pub type mask16x32 = Mask; /// Vector of two 32-bit masks -pub type mask32x2 = Mask32<2>; +pub type mask32x2 = Mask; /// Vector of four 32-bit masks -pub type mask32x4 = Mask32<4>; +pub type mask32x4 = Mask; /// Vector of eight 32-bit masks -pub type mask32x8 = Mask32<8>; +pub type mask32x8 = Mask; /// Vector of 16 32-bit masks -pub type mask32x16 = Mask32<16>; +pub type mask32x16 = Mask; /// Vector of two 64-bit masks -pub type mask64x2 = Mask64<2>; +pub type mask64x2 = Mask; /// Vector of four 64-bit masks -pub type mask64x4 = Mask64<4>; +pub type mask64x4 = Mask; /// Vector of eight 64-bit masks -pub type mask64x8 = Mask64<8>; +pub type mask64x8 = Mask; /// Vector of two pointer-width masks -pub type masksizex2 = MaskSize<2>; +pub type masksizex2 = Mask; /// Vector of four pointer-width masks -pub type masksizex4 = MaskSize<4>; +pub type masksizex4 = Mask; /// Vector of eight pointer-width masks -pub type masksizex8 = MaskSize<8>; +pub type masksizex8 = Mask; macro_rules! impl_from { { $from:ty => $($to:ty),* } => { diff --git a/crates/core_simd/tests/masks.rs b/crates/core_simd/tests/masks.rs index 61d8e449744..cf8039d153d 100644 --- a/crates/core_simd/tests/masks.rs +++ b/crates/core_simd/tests/masks.rs @@ -7,9 +7,9 @@ use wasm_bindgen_test::*; wasm_bindgen_test_configure!(run_in_browser); macro_rules! test_mask_api { - { $name:ident } => { + { $type:ident } => { #[allow(non_snake_case)] - mod $name { + mod $type { #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::*; @@ -17,7 +17,7 @@ macro_rules! test_mask_api { #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn set_and_test() { let values = [true, false, false, true, false, false, true, false]; - let mut mask = core_simd::$name::<8>::splat(false); + let mut mask = core_simd::Mask::<$type, 8>::splat(false); for (lane, value) in values.iter().copied().enumerate() { mask.set(lane, value); } @@ -29,7 +29,7 @@ macro_rules! test_mask_api { #[test] #[should_panic] fn set_invalid_lane() { - let mut mask = core_simd::$name::<8>::splat(false); + let mut mask = core_simd::Mask::<$type, 8>::splat(false); mask.set(8, true); let _ = mask; } @@ -37,24 +37,24 @@ macro_rules! test_mask_api { #[test] #[should_panic] fn test_invalid_lane() { - let mask = core_simd::$name::<8>::splat(false); + let mask = core_simd::Mask::<$type, 8>::splat(false); let _ = mask.test(8); } #[test] fn any() { - assert!(!core_simd::$name::<8>::splat(false).any()); - assert!(core_simd::$name::<8>::splat(true).any()); - let mut v = core_simd::$name::<8>::splat(false); + assert!(!core_simd::Mask::<$type, 8>::splat(false).any()); + assert!(core_simd::Mask::<$type, 8>::splat(true).any()); + let mut v = core_simd::Mask::<$type, 8>::splat(false); v.set(2, true); assert!(v.any()); } #[test] fn all() { - assert!(!core_simd::$name::<8>::splat(false).all()); - assert!(core_simd::$name::<8>::splat(true).all()); - let mut v = core_simd::$name::<8>::splat(false); + assert!(!core_simd::Mask::<$type, 8>::splat(false).all()); + assert!(core_simd::Mask::<$type, 8>::splat(true).all()); + let mut v = core_simd::Mask::<$type, 8>::splat(false); v.set(2, true); assert!(!v.all()); } @@ -62,10 +62,10 @@ macro_rules! test_mask_api { #[test] fn roundtrip_int_conversion() { let values = [true, false, false, true, false, false, true, false]; - let mask = core_simd::$name::<8>::from_array(values); + let mask = core_simd::Mask::<$type, 8>::from_array(values); let int = mask.to_int(); assert_eq!(int.to_array(), [-1, 0, 0, -1, 0, 0, -1, 0]); - assert_eq!(core_simd::$name::<8>::from_int(int), mask); + assert_eq!(core_simd::Mask::<$type, 8>::from_int(int), mask); } #[test] @@ -74,24 +74,24 @@ macro_rules! test_mask_api { true, false, false, true, false, false, true, false, true, true, false, false, false, false, false, true, ]; - let mask = core_simd::$name::<16>::from_array(values); + let mask = core_simd::Mask::<$type, 16>::from_array(values); let bitmask = mask.to_bitmask(); assert_eq!(bitmask, [0b01001001, 0b10000011]); - assert_eq!(core_simd::$name::<16>::from_bitmask(bitmask), mask); + assert_eq!(core_simd::Mask::<$type, 16>::from_bitmask(bitmask), mask); } } } } mod mask_api { - test_mask_api! { Mask8 } + test_mask_api! { i8 } } #[test] fn convert() { let values = [true, false, false, true, false, false, true, false]; assert_eq!( - core_simd::Mask8::from_array(values), - core_simd::Mask32::from_array(values).into() + core_simd::Mask::::from_array(values), + core_simd::Mask::::from_array(values).into() ); }