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 {
|
||||
{ $($ty:ident ($unsigned:ident)),* } => {
|
||||
{ $($ty:ty),* } => {
|
||||
$(
|
||||
impl<const LANES: usize> Sealed for Simd<$ty, LANES>
|
||||
where
|
||||
@ -353,18 +353,16 @@ fn trailing_zeros(self) -> Self {
|
||||
|
||||
#[inline]
|
||||
fn leading_ones(self) -> Self {
|
||||
use crate::simd::SimdUint;
|
||||
self.cast::<$unsigned>().leading_ones().cast()
|
||||
(!self).leading_zeros()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn trailing_ones(self) -> Self {
|
||||
use crate::simd::SimdUint;
|
||||
self.cast::<$unsigned>().trailing_ones().cast()
|
||||
(!self).trailing_zeros()
|
||||
}
|
||||
}
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
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