Skip to content

Commit 275889f

Browse files
committed
Remove remaining usage of aliases
1 parent f7f2968 commit 275889f

File tree

7 files changed

+87
-87
lines changed

7 files changed

+87
-87
lines changed

crates/core_simd/src/permute.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ macro_rules! impl_shuffle_lane {
1515
///
1616
/// ```
1717
/// #![feature(portable_simd)]
18-
/// # use core_simd::*;
19-
/// let a = f32x4::from_array([1.0, 2.0, 3.0, 4.0]);
20-
/// let b = f32x4::from_array([5.0, 6.0, 7.0, 8.0]);
18+
/// # use core_simd::Simd;
19+
/// let a = Simd::from_array([1.0, 2.0, 3.0, 4.0]);
20+
/// let b = Simd::from_array([5.0, 6.0, 7.0, 8.0]);
2121
/// const IDXS: [u32; 4] = [4,0,3,7];
22-
/// let c = f32x4::shuffle::<IDXS>(a,b);
23-
/// assert_eq!(f32x4::from_array([5.0, 1.0, 4.0, 8.0]), c);
22+
/// let c = Simd::<_, 4>::shuffle::<IDXS>(a,b);
23+
/// assert_eq!(Simd::from_array([5.0, 1.0, 4.0, 8.0]), c);
2424
/// ```
2525
#[inline]
2626
pub fn shuffle<const IDX: [u32; $n]>(self, second: Self) -> Self {
@@ -56,9 +56,9 @@ macro_rules! impl_shuffle_lane {
5656
///
5757
/// ```
5858
/// #![feature(portable_simd)]
59-
/// # use core_simd::SimdU32;
60-
/// let a = SimdU32::from_array([0, 1, 2, 3]);
61-
/// let b = SimdU32::from_array([4, 5, 6, 7]);
59+
/// # use core_simd::Simd;
60+
/// let a = Simd::from_array([0, 1, 2, 3]);
61+
/// let b = Simd::from_array([4, 5, 6, 7]);
6262
/// let (x, y) = a.interleave(b);
6363
/// assert_eq!(x.to_array(), [0, 4, 1, 5]);
6464
/// assert_eq!(y.to_array(), [2, 6, 3, 7]);
@@ -108,9 +108,9 @@ macro_rules! impl_shuffle_lane {
108108
///
109109
/// ```
110110
/// #![feature(portable_simd)]
111-
/// # use core_simd::SimdU32;
112-
/// let a = SimdU32::from_array([0, 4, 1, 5]);
113-
/// let b = SimdU32::from_array([2, 6, 3, 7]);
111+
/// # use core_simd::Simd;
112+
/// let a = Simd::from_array([0, 4, 1, 5]);
113+
/// let b = Simd::from_array([2, 6, 3, 7]);
114114
/// let (x, y) = a.deinterleave(b);
115115
/// assert_eq!(x.to_array(), [0, 1, 2, 3]);
116116
/// assert_eq!(y.to_array(), [4, 5, 6, 7]);

crates/core_simd/src/vector.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub use uint::*;
99
// Vectors of pointers are not for public use at the current time.
1010
pub(crate) mod ptr;
1111

12-
use crate::{LaneCount, MaskElement, SupportedLaneCount};
12+
use crate::{LaneCount, Mask, MaskElement, SupportedLaneCount};
1313

1414
/// A SIMD vector of `LANES` elements of type `Element`.
1515
#[repr(simd)]
@@ -54,16 +54,16 @@ where
5454
/// # #![feature(portable_simd)]
5555
/// # use core_simd::*;
5656
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
57-
/// let idxs = SimdUsize::<4>::from_array([9, 3, 0, 5]);
58-
/// let alt = SimdI32::from_array([-5, -4, -3, -2]);
57+
/// let idxs = Simd::from_array([9, 3, 0, 5]);
58+
/// let alt = Simd::from_array([-5, -4, -3, -2]);
5959
///
60-
/// let result = SimdI32::<4>::gather_or(&vec, idxs, alt); // Note the lane that is out-of-bounds.
61-
/// assert_eq!(result, SimdI32::from_array([-5, 13, 10, 15]));
60+
/// let result = Simd::gather_or(&vec, idxs, alt); // Note the lane that is out-of-bounds.
61+
/// assert_eq!(result, Simd::from_array([-5, 13, 10, 15]));
6262
/// ```
6363
#[must_use]
6464
#[inline]
65-
pub fn gather_or(slice: &[Element], idxs: crate::SimdUsize<LANES>, or: Self) -> Self {
66-
Self::gather_select(slice, crate::MaskSize::splat(true), idxs, or)
65+
pub fn gather_or(slice: &[Element], idxs: Simd<usize, LANES>, or: Self) -> Self {
66+
Self::gather_select(slice, Mask::splat(true), idxs, or)
6767
}
6868

6969
/// SIMD gather: construct a SIMD vector by reading from a slice, using potentially discontiguous indices.
@@ -72,14 +72,14 @@ where
7272
/// # #![feature(portable_simd)]
7373
/// # use core_simd::*;
7474
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
75-
/// let idxs = SimdUsize::<4>::from_array([9, 3, 0, 5]);
75+
/// let idxs = Simd::from_array([9, 3, 0, 5]);
7676
///
77-
/// let result = SimdI32::<4>::gather_or_default(&vec, idxs); // Note the lane that is out-of-bounds.
78-
/// assert_eq!(result, SimdI32::from_array([0, 13, 10, 15]));
77+
/// let result = Simd::gather_or_default(&vec, idxs); // Note the lane that is out-of-bounds.
78+
/// assert_eq!(result, Simd::from_array([0, 13, 10, 15]));
7979
/// ```
8080
#[must_use]
8181
#[inline]
82-
pub fn gather_or_default(slice: &[Element], idxs: crate::SimdUsize<LANES>) -> Self
82+
pub fn gather_or_default(slice: &[Element], idxs: Simd<usize, LANES>) -> Self
8383
where
8484
Element: Default,
8585
{
@@ -92,22 +92,22 @@ where
9292
/// # #![feature(portable_simd)]
9393
/// # use core_simd::*;
9494
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
95-
/// let idxs = SimdUsize::<4>::from_array([9, 3, 0, 5]);
96-
/// let alt = SimdI32::from_array([-5, -4, -3, -2]);
97-
/// let mask = MaskSize::from_array([true, true, true, false]); // Note the mask of the last lane.
95+
/// let idxs = Simd::from_array([9, 3, 0, 5]);
96+
/// let alt = Simd::from_array([-5, -4, -3, -2]);
97+
/// let mask = Mask::from_array([true, true, true, false]); // Note the mask of the last lane.
9898
///
99-
/// let result = SimdI32::<4>::gather_select(&vec, mask, idxs, alt); // Note the lane that is out-of-bounds.
100-
/// assert_eq!(result, SimdI32::from_array([-5, 13, 10, -2]));
99+
/// let result = Simd::gather_select(&vec, mask, idxs, alt); // Note the lane that is out-of-bounds.
100+
/// assert_eq!(result, Simd::from_array([-5, 13, 10, -2]));
101101
/// ```
102102
#[must_use]
103103
#[inline]
104104
pub fn gather_select(
105105
slice: &[Element],
106-
mask: crate::MaskSize<LANES>,
107-
idxs: crate::SimdUsize<LANES>,
106+
mask: Mask<isize, LANES>,
107+
idxs: Simd<usize, LANES>,
108108
or: Self,
109109
) -> Self {
110-
let mask = (mask & idxs.lanes_lt(crate::SimdUsize::splat(slice.len()))).to_int();
110+
let mask = (mask & idxs.lanes_lt(Simd::splat(slice.len()))).to_int();
111111
let base_ptr = crate::vector::ptr::SimdConstPtr::splat(slice.as_ptr());
112112
// Ferris forgive me, I have done pointer arithmetic here.
113113
let ptrs = base_ptr.wrapping_add(idxs);
@@ -122,15 +122,15 @@ where
122122
/// # #![feature(portable_simd)]
123123
/// # use core_simd::*;
124124
/// let mut vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
125-
/// let idxs = SimdUsize::<4>::from_array([9, 3, 0, 0]);
126-
/// let vals = SimdI32::from_array([-27, 82, -41, 124]);
125+
/// let idxs = Simd::from_array([9, 3, 0, 0]);
126+
/// let vals = Simd::from_array([-27, 82, -41, 124]);
127127
///
128128
/// vals.scatter(&mut vec, idxs); // index 0 receives two writes.
129129
/// assert_eq!(vec, vec![124, 11, 12, 82, 14, 15, 16, 17, 18]);
130130
/// ```
131131
#[inline]
132-
pub fn scatter(self, slice: &mut [Element], idxs: crate::SimdUsize<LANES>) {
133-
self.scatter_select(slice, crate::MaskSize::splat(true), idxs)
132+
pub fn scatter(self, slice: &mut [Element], idxs: Simd<usize, LANES>) {
133+
self.scatter_select(slice, Mask::splat(true), idxs)
134134
}
135135

136136
/// SIMD scatter: write a SIMD vector's values into a slice, using potentially discontiguous indices.
@@ -140,9 +140,9 @@ where
140140
/// # #![feature(portable_simd)]
141141
/// # use core_simd::*;
142142
/// let mut vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
143-
/// let idxs = SimdUsize::<4>::from_array([9, 3, 0, 0]);
144-
/// let vals = SimdI32::from_array([-27, 82, -41, 124]);
145-
/// let mask = MaskSize::from_array([true, true, true, false]); // Note the mask of the last lane.
143+
/// let idxs = Simd::from_array([9, 3, 0, 0]);
144+
/// let vals = Simd::from_array([-27, 82, -41, 124]);
145+
/// let mask = Mask::from_array([true, true, true, false]); // Note the mask of the last lane.
146146
///
147147
/// vals.scatter_select(&mut vec, mask, idxs); // index 0's second write is masked, thus omitted.
148148
/// assert_eq!(vec, vec![-41, 11, 12, 82, 14, 15, 16, 17, 18]);
@@ -151,11 +151,11 @@ where
151151
pub fn scatter_select(
152152
self,
153153
slice: &mut [Element],
154-
mask: crate::MaskSize<LANES>,
155-
idxs: crate::SimdUsize<LANES>,
154+
mask: Mask<isize, LANES>,
155+
idxs: Simd<usize, LANES>,
156156
) {
157157
// We must construct our scatter mask before we derive a pointer!
158-
let mask = (mask & idxs.lanes_lt(crate::SimdUsize::splat(slice.len()))).to_int();
158+
let mask = (mask & idxs.lanes_lt(Simd::splat(slice.len()))).to_int();
159159
// SAFETY: This block works with *mut T derived from &mut 'a [T],
160160
// which means it is delicate in Rust's borrowing model, circa 2021:
161161
// &mut 'a [T] asserts uniqueness, so deriving &'a [T] invalidates live *mut Ts!

crates/core_simd/src/vector/float.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
#![allow(non_camel_case_types)]
22

3-
use crate::{LaneCount, SupportedLaneCount};
3+
use crate::{LaneCount, Mask, Simd, SupportedLaneCount};
44

5-
/// Implements inherent methods for a float vector `$name` containing multiple
5+
/// Implements inherent methods for a float vector containing multiple
66
/// `$lanes` of float `$type`, which uses `$bits_ty` as its binary
7-
/// representation. Called from `define_float_vector!`.
7+
/// representation.
88
macro_rules! impl_float_vector {
9-
{ $name:ident, $type:ident, $bits_ty:ident, $mask_ty:ident, $mask_impl_ty:ident } => {
10-
impl<const LANES: usize> $name<LANES>
9+
{ $type:ty, $bits_ty:ty, $mask_ty:ty } => {
10+
impl<const LANES: usize> Simd<$type, LANES>
1111
where
1212
LaneCount<LANES>: SupportedLaneCount,
1313
{
1414
/// Raw transmutation to an unsigned integer vector type with the
1515
/// same size and number of lanes.
1616
#[inline]
17-
pub fn to_bits(self) -> crate::$bits_ty<LANES> {
18-
assert_eq!(core::mem::size_of::<Self>(), core::mem::size_of::<crate::$bits_ty<LANES>>());
17+
pub fn to_bits(self) -> Simd<$bits_ty, LANES> {
18+
assert_eq!(core::mem::size_of::<Self>(), core::mem::size_of::<Simd<$bits_ty, LANES>>());
1919
unsafe { core::mem::transmute_copy(&self) }
2020
}
2121

2222
/// Raw transmutation from an unsigned integer vector type with the
2323
/// same size and number of lanes.
2424
#[inline]
25-
pub fn from_bits(bits: crate::$bits_ty<LANES>) -> Self {
26-
assert_eq!(core::mem::size_of::<Self>(), core::mem::size_of::<crate::$bits_ty<LANES>>());
25+
pub fn from_bits(bits: Simd<$bits_ty, LANES>) -> Self {
26+
assert_eq!(core::mem::size_of::<Self>(), core::mem::size_of::<Simd<$bits_ty, LANES>>());
2727
unsafe { core::mem::transmute_copy(&bits) }
2828
}
2929

@@ -64,58 +64,58 @@ macro_rules! impl_float_vector {
6464
#[inline]
6565
pub fn to_degrees(self) -> Self {
6666
// to_degrees uses a special constant for better precision, so extract that constant
67-
self * Self::splat($type::to_degrees(1.))
67+
self * Self::splat(<$type>::to_degrees(1.))
6868
}
6969

7070
/// Converts each lane from degrees to radians.
7171
#[inline]
7272
pub fn to_radians(self) -> Self {
73-
self * Self::splat($type::to_radians(1.))
73+
self * Self::splat(<$type>::to_radians(1.))
7474
}
7575

7676
/// Returns true for each lane if it has a positive sign, including
7777
/// `+0.0`, `NaN`s with positive sign bit and positive infinity.
7878
#[inline]
79-
pub fn is_sign_positive(self) -> crate::$mask_ty<LANES> {
79+
pub fn is_sign_positive(self) -> Mask<$mask_ty, LANES> {
8080
!self.is_sign_negative()
8181
}
8282

8383
/// Returns true for each lane if it has a negative sign, including
8484
/// `-0.0`, `NaN`s with negative sign bit and negative infinity.
8585
#[inline]
86-
pub fn is_sign_negative(self) -> crate::$mask_ty<LANES> {
87-
let sign_bits = self.to_bits() & crate::$bits_ty::splat((!0 >> 1) + 1);
88-
sign_bits.lanes_gt(crate::$bits_ty::splat(0))
86+
pub fn is_sign_negative(self) -> Mask<$mask_ty, LANES> {
87+
let sign_bits = self.to_bits() & Simd::splat((!0 >> 1) + 1);
88+
sign_bits.lanes_gt(Simd::splat(0))
8989
}
9090

9191
/// Returns true for each lane if its value is `NaN`.
9292
#[inline]
93-
pub fn is_nan(self) -> crate::$mask_ty<LANES> {
93+
pub fn is_nan(self) -> Mask<$mask_ty, LANES> {
9494
self.lanes_ne(self)
9595
}
9696

9797
/// Returns true for each lane if its value is positive infinity or negative infinity.
9898
#[inline]
99-
pub fn is_infinite(self) -> crate::$mask_ty<LANES> {
99+
pub fn is_infinite(self) -> Mask<$mask_ty, LANES> {
100100
self.abs().lanes_eq(Self::splat(<$type>::INFINITY))
101101
}
102102

103103
/// Returns true for each lane if its value is neither infinite nor `NaN`.
104104
#[inline]
105-
pub fn is_finite(self) -> crate::$mask_ty<LANES> {
105+
pub fn is_finite(self) -> Mask<$mask_ty, LANES> {
106106
self.abs().lanes_lt(Self::splat(<$type>::INFINITY))
107107
}
108108

109109
/// Returns true for each lane if its value is subnormal.
110110
#[inline]
111-
pub fn is_subnormal(self) -> crate::$mask_ty<LANES> {
112-
self.abs().lanes_ne(Self::splat(0.0)) & (self.to_bits() & Self::splat(<$type>::INFINITY).to_bits()).lanes_eq(crate::$bits_ty::splat(0))
111+
pub fn is_subnormal(self) -> Mask<$mask_ty, LANES> {
112+
self.abs().lanes_ne(Self::splat(0.0)) & (self.to_bits() & Self::splat(<$type>::INFINITY).to_bits()).lanes_eq(Simd::splat(0))
113113
}
114114

115115
/// Returns true for each lane if its value is neither neither zero, infinite,
116116
/// subnormal, or `NaN`.
117117
#[inline]
118-
pub fn is_normal(self) -> crate::$mask_ty<LANES> {
118+
pub fn is_normal(self) -> Mask<$mask_ty, LANES> {
119119
!(self.abs().lanes_eq(Self::splat(0.0)) | self.is_nan() | self.is_subnormal() | self.is_infinite())
120120
}
121121

@@ -126,7 +126,7 @@ macro_rules! impl_float_vector {
126126
/// * `NAN` if the number is `NAN`
127127
#[inline]
128128
pub fn signum(self) -> Self {
129-
self.is_nan().select(Self::splat($type::NAN), Self::splat(1.0).copysign(self))
129+
self.is_nan().select(Self::splat(<$type>::NAN), Self::splat(1.0).copysign(self))
130130
}
131131

132132
/// Returns each lane with the magnitude of `self` and the sign of `sign`.
@@ -189,8 +189,8 @@ pub type SimdF32<const LANES: usize> = crate::Simd<f32, LANES>;
189189
/// A SIMD vector of containing `LANES` `f64` values.
190190
pub type SimdF64<const LANES: usize> = crate::Simd<f64, LANES>;
191191

192-
impl_float_vector! { SimdF32, f32, SimdU32, Mask32, SimdI32 }
193-
impl_float_vector! { SimdF64, f64, SimdU64, Mask64, SimdI64 }
192+
impl_float_vector! { f32, u32, i32 }
193+
impl_float_vector! { f64, u64, i64 }
194194

195195
/// Vector of two `f32` values
196196
pub type f32x2 = SimdF32<2>;

crates/core_simd/src/vector/int.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
#![allow(non_camel_case_types)]
22

3-
use crate::{LaneCount, SupportedLaneCount};
3+
use crate::{LaneCount, Mask, Simd, SupportedLaneCount};
44

55
/// Implements additional integer traits (Eq, Ord, Hash) on the specified vector `$name`, holding multiple `$lanes` of `$type`.
66
macro_rules! impl_integer_vector {
7-
{ $name:ident, $type:ty, $mask_ty:ident, $mask_impl_ty:ident } => {
8-
impl<const LANES: usize> $name<LANES>
7+
{ $type:ty } => {
8+
impl<const LANES: usize> Simd<$type, LANES>
99
where
1010
LaneCount<LANES>: SupportedLaneCount,
1111
{
1212
/// Returns true for each positive lane and false if it is zero or negative.
1313
#[inline]
14-
pub fn is_positive(self) -> crate::$mask_ty<LANES> {
14+
pub fn is_positive(self) -> Mask<$type, LANES> {
1515
self.lanes_gt(Self::splat(0))
1616
}
1717

1818
/// Returns true for each negative lane and false if it is zero or positive.
1919
#[inline]
20-
pub fn is_negative(self) -> crate::$mask_ty<LANES> {
20+
pub fn is_negative(self) -> Mask<$type, LANES> {
2121
self.lanes_lt(Self::splat(0))
2222
}
2323

@@ -51,11 +51,11 @@ pub type SimdI64<const LANES: usize> = crate::Simd<i64, LANES>;
5151
/// A SIMD vector of containing `LANES` `isize` values.
5252
pub type SimdIsize<const LANES: usize> = crate::Simd<isize, LANES>;
5353

54-
impl_integer_vector! { SimdIsize, isize, MaskSize, SimdIsize }
55-
impl_integer_vector! { SimdI16, i16, Mask16, SimdI16 }
56-
impl_integer_vector! { SimdI32, i32, Mask32, SimdI32 }
57-
impl_integer_vector! { SimdI64, i64, Mask64, SimdI64 }
58-
impl_integer_vector! { SimdI8, i8, Mask8, SimdI8 }
54+
impl_integer_vector! { isize }
55+
impl_integer_vector! { i16 }
56+
impl_integer_vector! { i32 }
57+
impl_integer_vector! { i64 }
58+
impl_integer_vector! { i8 }
5959

6060
/// Vector of two `isize` values
6161
pub type isizex2 = SimdIsize<2>;

crates/core_simd/src/vector/ptr.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Private implementation details of public gather/scatter APIs.
2-
use crate::{LaneCount, SimdUsize, SupportedLaneCount};
2+
use crate::{LaneCount, Simd, SupportedLaneCount};
33
use core::mem;
44

55
/// A vector of *const T.
@@ -20,9 +20,9 @@ where
2020

2121
#[inline]
2222
#[must_use]
23-
pub fn wrapping_add(self, addend: SimdUsize<LANES>) -> Self {
23+
pub fn wrapping_add(self, addend: Simd<usize, LANES>) -> Self {
2424
unsafe {
25-
let x: SimdUsize<LANES> = mem::transmute_copy(&self);
25+
let x: Simd<usize, LANES> = mem::transmute_copy(&self);
2626
mem::transmute_copy(&{ x + (addend * mem::size_of::<T>()) })
2727
}
2828
}
@@ -46,9 +46,9 @@ where
4646

4747
#[inline]
4848
#[must_use]
49-
pub fn wrapping_add(self, addend: SimdUsize<LANES>) -> Self {
49+
pub fn wrapping_add(self, addend: Simd<usize, LANES>) -> Self {
5050
unsafe {
51-
let x: SimdUsize<LANES> = mem::transmute_copy(&self);
51+
let x: Simd<usize, LANES> = mem::transmute_copy(&self);
5252
mem::transmute_copy(&{ x + (addend * mem::size_of::<T>()) })
5353
}
5454
}

0 commit comments

Comments
 (0)