pub trait SimdIntElement:
SimdElement
+ Eq
+ Ord
+ Binary
+ Not<Output = Self>
+ Shl<usize, Output = Self>
+ ShlAssign<usize>
+ Shr<usize, Output = Self>
+ ShrAssign<usize>
+ BitAnd<Self, Output = Self>
+ BitAndAssign<Self>
+ BitOr<Self, Output = Self>
+ BitOrAssign<Self>
+ BitXor<Self, Output = Self>
+ BitXorAssign<Self>
+ TryFrom<u8, Error: Copy + Error + Eq>
+ TryFrom<u16, Error: Copy + Error + Eq>
+ TryFrom<u32, Error: Copy + Error + Eq>
+ TryFrom<u64, Error: Copy + Error + Eq>
+ TryFrom<u128, Error: Copy + Error + Eq>
+ TryFrom<usize, Error: Copy + Error + Eq>
+ TryFrom<i8, Error: Copy + Error + Eq>
+ TryFrom<i16, Error: Copy + Error + Eq>
+ TryFrom<i32, Error: Copy + Error + Eq>
+ TryFrom<i64, Error: Copy + Error + Eq>
+ TryFrom<i128, Error: Copy + Error + Eq>
+ TryFrom<isize, Error: Copy + Error + Eq>
+ for<'a> Shl<&'a usize, Output = Self>
+ for<'a> ShlAssign<&'a usize>
+ for<'a> Shr<&'a usize, Output = Self>
+ for<'a> ShrAssign<&'a usize>
+ for<'a> BitAnd<&'a Self, Output = Self>
+ for<'a> BitAndAssign<&'a Self>
+ for<'a> BitOr<&'a Self, Output = Self>
+ for<'a> BitOrAssign<&'a Self>
+ for<'a> BitXor<&'a Self, Output = Self>
+ for<'a> BitXorAssign<&'a Self> {
type Native<S: Simd>: SimdInt<S, Element = Self, Unsigned = <Self::Unsigned as SimdIntElement>::Native<S>, Signed = <Self::Signed as SimdIntElement>::Native<S>>;
type Unsigned: SimdIntElement<Mask = Self::Mask, Unsigned = Self::Unsigned, Signed = Self::Signed>;
type Signed: SimdIntElement<Mask = Self::Mask, Unsigned = Self::Unsigned, Signed = Self::Signed>;
}Expand description
Types that can be used as elements in integer SIMD vectors.
Self::Native selects the native-width vector for this scalar type and a
SIMD backend, so an integer-generic caller can use crate::dispatch!:
use fearless_simd::{dispatch, prelude::*, Level};
#[inline(always)]
fn count_ones_simd<S: Simd, T: SimdIntElement>(simd: S, value: T) -> T {
T::Native::<S>::splat(simd, value).count_ones()[0]
}
fn count_ones<T: SimdIntElement>(level: Level, value: T) -> T {
dispatch!(level, simd => count_ones_simd(simd, value))
}
let level = Level::new();
assert_eq!(count_ones(level, 7_u8), 3);
assert_eq!(count_ones(level, 7_i64), 3);Required Associated Types§
Sourcetype Native<S: Simd>: SimdInt<S, Element = Self, Unsigned = <Self::Unsigned as SimdIntElement>::Native<S>, Signed = <Self::Signed as SimdIntElement>::Native<S>>
type Native<S: Simd>: SimdInt<S, Element = Self, Unsigned = <Self::Unsigned as SimdIntElement>::Native<S>, Signed = <Self::Signed as SimdIntElement>::Native<S>>
The native-width integer vector for this scalar type and backend S.
Its lane count depends on both the scalar type and the backend, and is
available as T::Native::<S>::LEN with SimdBase in scope.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".