Trait SimdInt

pub trait SimdInt<S: Simd>: SimdBase<S, Element: SimdIntElement> + Seal + BitAnd<Output = Self> + BitAndAssign + BitAnd<Self::Element, Output = Self> + BitAndAssign<Self::Element> + BitOr<Output = Self> + BitOrAssign + BitOr<Self::Element, Output = Self> + BitOrAssign<Self::Element> + BitXor<Output = Self> + BitXorAssign + BitXor<Self::Element, Output = Self> + BitXorAssign<Self::Element> + Not<Output = Self> + Shl<u32, Output = Self> + ShlAssign<u32> + Shl<Output = Self> + ShlAssign + Shr<u32, Output = Self> + ShrAssign<u32> + Shr<Output = Self> + ShrAssign

Functionality implemented by (signed and unsigned) integer SIMD vectors.

Required Methods

fn count_ones(self) -> Self

Return the number of ones in the binary representation of each element.

fn count_zeros(self) -> Self

Return the number of zeros in the binary representation of each element.

fn saturating_add(self, rhs: impl SimdInto<Self, S>) -> Self

Add two vectors element-wise, saturating on overflow.

"Saturating" means that if the result is not representable, the closest representable value (either Element::MAX or Element::MIN) is returned.

On x86 it is implemented in hardware only for 8-bit and 16-bit elements. For 32-bit and 64-bit vectors this operation is slower than wrapping addition on x86.

fn saturating_sub(self, rhs: impl SimdInto<Self, S>) -> Self

Subtract two vectors element-wise, saturating on overflow.

"Saturating" means that if the result is not representable, the closest representable value (either Element::MAX or Element::MIN) is returned.

On x86 it is implemented in hardware only for 8-bit and 16-bit elements. For 32-bit and 64-bit vectors this operation is slower than wrapping subtraction on x86.

Provided Methods

fn to_float<T: SimdCvtFloat<Self>>(self) -> T

Convert this integer type to a floating-point type. This is a convenience method that delegates to SimdCvtFloat::float_from, and can only be called if there actually exists a target type of the same bit width (f32 or f64).

Implementors