about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCaleb Zulawski <caleb.zulawski@gmail.com>2021-08-07 21:22:10 +0000
committerCaleb Zulawski <caleb.zulawski@gmail.com>2021-08-07 21:22:10 +0000
commit00165ed5beea0dbbbb950afba692b4c804485c03 (patch)
treebafb7d85ad6b1966dd6c1000a1641a4b505dfb5a
parent40142ac034088c0ca149d4ca511bc854c70ff238 (diff)
downloadrust-00165ed5beea0dbbbb950afba692b4c804485c03.tar.gz
rust-00165ed5beea0dbbbb950afba692b4c804485c03.zip
Remove mask aliases
-rw-r--r--crates/core_simd/src/masks.rs51
-rw-r--r--crates/core_simd/tests/masks.rs36
2 files changed, 36 insertions, 51 deletions
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<const LANES: usize> = Mask<i8, LANES>;
-
-/// A SIMD mask of `LANES` 16-bit values.
-pub type Mask16<const LANES: usize> = Mask<i16, LANES>;
-
-/// A SIMD mask of `LANES` 32-bit values.
-pub type Mask32<const LANES: usize> = Mask<i32, LANES>;
-
-/// A SIMD mask of `LANES` 64-bit values.
-pub type Mask64<const LANES: usize> = Mask<i64, LANES>;
-
-/// A SIMD mask of `LANES` pointer-width values.
-pub type MaskSize<const LANES: usize> = Mask<isize, LANES>;
-
 /// Vector of eight 8-bit masks
-pub type mask8x8 = Mask8<8>;
+pub type mask8x8 = Mask<i8, 8>;
 
 /// Vector of 16 8-bit masks
-pub type mask8x16 = Mask8<16>;
+pub type mask8x16 = Mask<i8, 16>;
 
 /// Vector of 32 8-bit masks
-pub type mask8x32 = Mask8<32>;
+pub type mask8x32 = Mask<i8, 32>;
 
 /// Vector of 16 8-bit masks
-pub type mask8x64 = Mask8<64>;
+pub type mask8x64 = Mask<i8, 64>;
 
 /// Vector of four 16-bit masks
-pub type mask16x4 = Mask16<4>;
+pub type mask16x4 = Mask<i16, 4>;
 
 /// Vector of eight 16-bit masks
-pub type mask16x8 = Mask16<8>;
+pub type mask16x8 = Mask<i16, 8>;
 
 /// Vector of 16 16-bit masks
-pub type mask16x16 = Mask16<16>;
+pub type mask16x16 = Mask<i16, 16>;
 
 /// Vector of 32 16-bit masks
-pub type mask16x32 = Mask32<32>;
+pub type mask16x32 = Mask<i32, 32>;
 
 /// Vector of two 32-bit masks
-pub type mask32x2 = Mask32<2>;
+pub type mask32x2 = Mask<i32, 2>;
 
 /// Vector of four 32-bit masks
-pub type mask32x4 = Mask32<4>;
+pub type mask32x4 = Mask<i32, 4>;
 
 /// Vector of eight 32-bit masks
-pub type mask32x8 = Mask32<8>;
+pub type mask32x8 = Mask<i32, 8>;
 
 /// Vector of 16 32-bit masks
-pub type mask32x16 = Mask32<16>;
+pub type mask32x16 = Mask<i32, 16>;
 
 /// Vector of two 64-bit masks
-pub type mask64x2 = Mask64<2>;
+pub type mask64x2 = Mask<i64, 2>;
 
 /// Vector of four 64-bit masks
-pub type mask64x4 = Mask64<4>;
+pub type mask64x4 = Mask<i64, 4>;
 
 /// Vector of eight 64-bit masks
-pub type mask64x8 = Mask64<8>;
+pub type mask64x8 = Mask<i64, 8>;
 
 /// Vector of two pointer-width masks
-pub type masksizex2 = MaskSize<2>;
+pub type masksizex2 = Mask<isize, 2>;
 
 /// Vector of four pointer-width masks
-pub type masksizex4 = MaskSize<4>;
+pub type masksizex4 = Mask<isize, 4>;
 
 /// Vector of eight pointer-width masks
-pub type masksizex8 = MaskSize<8>;
+pub type masksizex8 = Mask<isize, 8>;
 
 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::<i8, 8>::from_array(values),
+        core_simd::Mask::<i32, 8>::from_array(values).into()
     );
 }