Simplify signed leading_ones/trailing_ones
This commit is contained in:
parent
b1245ffb12
commit
c948b703ff
@ -213,7 +213,7 @@ pub trait SimdInt: Copy + Sealed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! impl_trait {
|
macro_rules! impl_trait {
|
||||||
{ $($ty:ident ($unsigned:ident)),* } => {
|
{ $($ty:ty),* } => {
|
||||||
$(
|
$(
|
||||||
impl<const LANES: usize> Sealed for Simd<$ty, LANES>
|
impl<const LANES: usize> Sealed for Simd<$ty, LANES>
|
||||||
where
|
where
|
||||||
@ -353,18 +353,16 @@ fn trailing_zeros(self) -> Self {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn leading_ones(self) -> Self {
|
fn leading_ones(self) -> Self {
|
||||||
use crate::simd::SimdUint;
|
(!self).leading_zeros()
|
||||||
self.cast::<$unsigned>().leading_ones().cast()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn trailing_ones(self) -> Self {
|
fn trailing_ones(self) -> Self {
|
||||||
use crate::simd::SimdUint;
|
(!self).trailing_zeros()
|
||||||
self.cast::<$unsigned>().trailing_ones().cast()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)*
|
)*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_trait! { i8 (u8), i16 (u16), i32 (u32), i64 (u64), isize (usize) }
|
impl_trait! { i8, i16, i32, i64, isize }
|
||||||
|
Loading…
Reference in New Issue
Block a user