Skip to content

Commit 00165ed

Browse files
committed
Remove mask aliases
1 parent 40142ac commit 00165ed

File tree

2 files changed

+36
-51
lines changed

2 files changed

+36
-51
lines changed

crates/core_simd/src/masks.rs

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -452,74 +452,59 @@ where
452452
}
453453
}
454454

455-
/// A SIMD mask of `LANES` 8-bit values.
456-
pub type Mask8<const LANES: usize> = Mask<i8, LANES>;
457-
458-
/// A SIMD mask of `LANES` 16-bit values.
459-
pub type Mask16<const LANES: usize> = Mask<i16, LANES>;
460-
461-
/// A SIMD mask of `LANES` 32-bit values.
462-
pub type Mask32<const LANES: usize> = Mask<i32, LANES>;
463-
464-
/// A SIMD mask of `LANES` 64-bit values.
465-
pub type Mask64<const LANES: usize> = Mask<i64, LANES>;
466-
467-
/// A SIMD mask of `LANES` pointer-width values.
468-
pub type MaskSize<const LANES: usize> = Mask<isize, LANES>;
469-
470455
/// Vector of eight 8-bit masks
471-
pub type mask8x8 = Mask8<8>;
456+
pub type mask8x8 = Mask<i8, 8>;
472457

473458
/// Vector of 16 8-bit masks
474-
pub type mask8x16 = Mask8<16>;
459+
pub type mask8x16 = Mask<i8, 16>;
475460

476461
/// Vector of 32 8-bit masks
477-
pub type mask8x32 = Mask8<32>;
462+
pub type mask8x32 = Mask<i8, 32>;
478463

479464
/// Vector of 16 8-bit masks
480-
pub type mask8x64 = Mask8<64>;
465+
pub type mask8x64 = Mask<i8, 64>;
481466

482467
/// Vector of four 16-bit masks
483-
pub type mask16x4 = Mask16<4>;
468+
pub type mask16x4 = Mask<i16, 4>;
484469

485470
/// Vector of eight 16-bit masks
486-
pub type mask16x8 = Mask16<8>;
471+
pub type mask16x8 = Mask<i16, 8>;
487472

488473
/// Vector of 16 16-bit masks
489-
pub type mask16x16 = Mask16<16>;
474+
pub type mask16x16 = Mask<i16, 16>;
490475

491476
/// Vector of 32 16-bit masks
492-
pub type mask16x32 = Mask32<32>;
477+
pub type mask16x32 = Mask<i32, 32>;
493478

494479
/// Vector of two 32-bit masks
495-
pub type mask32x2 = Mask32<2>;
480+
pub type mask32x2 = Mask<i32, 2>;
496481

497482
/// Vector of four 32-bit masks
498-
pub type mask32x4 = Mask32<4>;
483+
pub type mask32x4 = Mask<i32, 4>;
499484

500485
/// Vector of eight 32-bit masks
501-
pub type mask32x8 = Mask32<8>;
486+
pub type mask32x8 = Mask<i32, 8>;
502487

503488
/// Vector of 16 32-bit masks
504-
pub type mask32x16 = Mask32<16>;
489+
pub type mask32x16 = Mask<i32, 16>;
505490

506491
/// Vector of two 64-bit masks
507-
pub type mask64x2 = Mask64<2>;
492+
pub type mask64x2 = Mask<i64, 2>;
508493

509494
/// Vector of four 64-bit masks
510-
pub type mask64x4 = Mask64<4>;
495+
pub type mask64x4 = Mask<i64, 4>;
511496

512497
/// Vector of eight 64-bit masks
513-
pub type mask64x8 = Mask64<8>;
498+
pub type mask64x8 = Mask<i64, 8>;
514499

515500
/// Vector of two pointer-width masks
516-
pub type masksizex2 = MaskSize<2>;
501+
pub type masksizex2 = Mask<isize, 2>;
517502

518503
/// Vector of four pointer-width masks
519-
pub type masksizex4 = MaskSize<4>;
504+
pub type masksizex4 = Mask<isize, 4>;
520505

521506
/// Vector of eight pointer-width masks
522-
pub type masksizex8 = MaskSize<8>;
507+
pub type masksizex8 = Mask<isize, 8>;
523508

524509
macro_rules! impl_from {
525510
{ $from:ty => $($to:ty),* } => {

crates/core_simd/tests/masks.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ use wasm_bindgen_test::*;
77
wasm_bindgen_test_configure!(run_in_browser);
88

99
macro_rules! test_mask_api {
10-
{ $name:ident } => {
10+
{ $type:ident } => {
1111
#[allow(non_snake_case)]
12-
mod $name {
12+
mod $type {
1313
#[cfg(target_arch = "wasm32")]
1414
use wasm_bindgen_test::*;
1515

1616
#[test]
1717
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
1818
fn set_and_test() {
1919
let values = [true, false, false, true, false, false, true, false];
20-
let mut mask = core_simd::$name::<8>::splat(false);
20+
let mut mask = core_simd::Mask::<$type, 8>::splat(false);
2121
for (lane, value) in values.iter().copied().enumerate() {
2222
mask.set(lane, value);
2323
}
@@ -29,43 +29,43 @@ macro_rules! test_mask_api {
2929
#[test]
3030
#[should_panic]
3131
fn set_invalid_lane() {
32-
let mut mask = core_simd::$name::<8>::splat(false);
32+
let mut mask = core_simd::Mask::<$type, 8>::splat(false);
3333
mask.set(8, true);
3434
let _ = mask;
3535
}
3636

3737
#[test]
3838
#[should_panic]
3939
fn test_invalid_lane() {
40-
let mask = core_simd::$name::<8>::splat(false);
40+
let mask = core_simd::Mask::<$type, 8>::splat(false);
4141
let _ = mask.test(8);
4242
}
4343

4444
#[test]
4545
fn any() {
46-
assert!(!core_simd::$name::<8>::splat(false).any());
47-
assert!(core_simd::$name::<8>::splat(true).any());
48-
let mut v = core_simd::$name::<8>::splat(false);
46+
assert!(!core_simd::Mask::<$type, 8>::splat(false).any());
47+
assert!(core_simd::Mask::<$type, 8>::splat(true).any());
48+
let mut v = core_simd::Mask::<$type, 8>::splat(false);
4949
v.set(2, true);
5050
assert!(v.any());
5151
}
5252

5353
#[test]
5454
fn all() {
55-
assert!(!core_simd::$name::<8>::splat(false).all());
56-
assert!(core_simd::$name::<8>::splat(true).all());
57-
let mut v = core_simd::$name::<8>::splat(false);
55+
assert!(!core_simd::Mask::<$type, 8>::splat(false).all());
56+
assert!(core_simd::Mask::<$type, 8>::splat(true).all());
57+
let mut v = core_simd::Mask::<$type, 8>::splat(false);
5858
v.set(2, true);
5959
assert!(!v.all());
6060
}
6161

6262
#[test]
6363
fn roundtrip_int_conversion() {
6464
let values = [true, false, false, true, false, false, true, false];
65-
let mask = core_simd::$name::<8>::from_array(values);
65+
let mask = core_simd::Mask::<$type, 8>::from_array(values);
6666
let int = mask.to_int();
6767
assert_eq!(int.to_array(), [-1, 0, 0, -1, 0, 0, -1, 0]);
68-
assert_eq!(core_simd::$name::<8>::from_int(int), mask);
68+
assert_eq!(core_simd::Mask::<$type, 8>::from_int(int), mask);
6969
}
7070

7171
#[test]
@@ -74,24 +74,24 @@ macro_rules! test_mask_api {
7474
true, false, false, true, false, false, true, false,
7575
true, true, false, false, false, false, false, true,
7676
];
77-
let mask = core_simd::$name::<16>::from_array(values);
77+
let mask = core_simd::Mask::<$type, 16>::from_array(values);
7878
let bitmask = mask.to_bitmask();
7979
assert_eq!(bitmask, [0b01001001, 0b10000011]);
80-
assert_eq!(core_simd::$name::<16>::from_bitmask(bitmask), mask);
80+
assert_eq!(core_simd::Mask::<$type, 16>::from_bitmask(bitmask), mask);
8181
}
8282
}
8383
}
8484
}
8585

8686
mod mask_api {
87-
test_mask_api! { Mask8 }
87+
test_mask_api! { i8 }
8888
}
8989

9090
#[test]
9191
fn convert() {
9292
let values = [true, false, false, true, false, false, true, false];
9393
assert_eq!(
94-
core_simd::Mask8::from_array(values),
95-
core_simd::Mask32::from_array(values).into()
94+
core_simd::Mask::<i8, 8>::from_array(values),
95+
core_simd::Mask::<i32, 8>::from_array(values).into()
9696
);
9797
}

0 commit comments

Comments
 (0)