Skip to main content

SimdInt

Trait SimdInt 

Source
pub trait SimdInt<S: Simd>:
    SimdBase<S>
    + Add<Output = Self>
    + AddAssign
    + Add<Self::Element, Output = Self>
    + AddAssign<Self::Element>
    + Sub<Output = Self>
    + SubAssign
    + Sub<Self::Element, Output = Self>
    + SubAssign<Self::Element>
    + Mul<Output = Self>
    + MulAssign
    + Mul<Self::Element, Output = Self>
    + MulAssign<Self::Element>
    + 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 {
Show 14 methods // Required methods fn simd_eq(self, rhs: impl SimdInto<Self, S>) -> Self::Mask; fn simd_lt(self, rhs: impl SimdInto<Self, S>) -> Self::Mask; fn simd_le(self, rhs: impl SimdInto<Self, S>) -> Self::Mask; fn simd_ge(self, rhs: impl SimdInto<Self, S>) -> Self::Mask; fn simd_gt(self, rhs: impl SimdInto<Self, S>) -> Self::Mask; fn zip_low(self, rhs: impl SimdInto<Self, S>) -> Self; fn zip_high(self, rhs: impl SimdInto<Self, S>) -> Self; fn unzip_low(self, rhs: impl SimdInto<Self, S>) -> Self; fn unzip_high(self, rhs: impl SimdInto<Self, S>) -> Self; fn interleave(self, rhs: impl SimdInto<Self, S>) -> (Self, Self); fn deinterleave(self, rhs: impl SimdInto<Self, S>) -> (Self, Self); fn min(self, rhs: impl SimdInto<Self, S>) -> Self; fn max(self, rhs: impl SimdInto<Self, S>) -> Self; // Provided method fn to_float<T: SimdCvtFloat<Self>>(self) -> T { ... }
}
Expand description

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

Required Methods§

Source

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

Compare two vectors element-wise for equality.

Returns a mask where each element is all ones if the corresponding elements are equal, and all zeroes if not.

Source

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

Compare two vectors element-wise for less than.

Returns a mask where each element is all ones if self is less than rhs, and all zeroes if not.

Source

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

Compare two vectors element-wise for less than or equal.

Returns a mask where each element is all ones if self is less than or equal to rhs, and all zeroes if not.

Source

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

Compare two vectors element-wise for greater than or equal.

Returns a mask where each element is all ones if self is greater than or equal to rhs, and all zeroes if not.

Source

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

Compare two vectors element-wise for greater than.

Returns a mask where each element is all ones if self is greater than rhs, and all zeroes if not.

Source

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

Interleave the lower half elements of two vectors.

For vectors [a0, a1, a2, a3] and [b0, b1, b2, b3], returns [a0, b0, a1, b1].

Note: This operation is only useful if you need to discard elements a2, a3, b2, b3. For fully interleaving two vectors prefer interleave, which is faster than zip_low followed by zip_high on some platforms.

Source

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

Interleave the upper half elements of two vectors.

For vectors [a0, a1, a2, a3] and [b0, b1, b2, b3], returns [a2, b2, a3, b3].

Note: This operation is only useful if you need to discard elements a0, a1, b0, b1.For fully interleaving two vectors prefer interleave, which is faster than zip_low followed by zip_high on some platforms.

Source

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

Extract even-indexed elements from two vectors.

For vectors [a0, a1, a2, a3] and [b0, b1, b2, b3], returns [a0, a2, b0, b2].

Note: This operation is only useful if you need to discard elements a1, a3, b1, b3.For fully deinterleaving two vectors prefer deinterleave, which is faster than unzip_low followed by unzip_high on some platforms.

Source

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

Extract odd-indexed elements from two vectors.

For vectors [a0, a1, a2, a3] and [b0, b1, b2, b3], returns [a1, a3, b1, b3].

Note: This operation is only useful if you need to discard elements a0, a2, b0, b2.For fully deinterleaving two vectors prefer deinterleave, which is faster than unzip_low followed by unzip_high on some platforms.

Source

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

Interleave two vectors.

The resulting vectors contain elements taken alternately from self and rhs, first filling the first result, and then the second.

The reverse of this operation is deinterleave.

For vectors [a0, a1, a2, a3] and [b0, b1, b2, b3], returns ([a0, b0, a1, b1], [a2, b2, a3, b3]).

Source

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

Deinterleave two vectors.

The first result contains all even-indexed elements from self followed by all even-indexed elements from rhs. The second result contains all odd-indexed elements from self followed by all odd-indexed elements from rhs.

The reverse of this operation is interleave.

For vectors [a0, b0, a1, b1] and [a2, b2, a3, b3], returns ([a0, a1, a2, a3], [b0, b1, b2, b3]).

Source

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

Return the element-wise minimum of two vectors.

Source

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

Return the element-wise maximum of two vectors.

Provided Methods§

Source

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 (currently, only f32).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S: Simd> SimdInt<S> for i8x16<S>

Source§

impl<S: Simd> SimdInt<S> for i8x32<S>

Source§

impl<S: Simd> SimdInt<S> for i8x64<S>

Source§

impl<S: Simd> SimdInt<S> for i16x8<S>

Source§

impl<S: Simd> SimdInt<S> for i16x16<S>

Source§

impl<S: Simd> SimdInt<S> for i16x32<S>

Source§

impl<S: Simd> SimdInt<S> for i32x4<S>

Source§

impl<S: Simd> SimdInt<S> for i32x8<S>

Source§

impl<S: Simd> SimdInt<S> for i32x16<S>

Source§

impl<S: Simd> SimdInt<S> for u8x16<S>

Source§

impl<S: Simd> SimdInt<S> for u8x32<S>

Source§

impl<S: Simd> SimdInt<S> for u8x64<S>

Source§

impl<S: Simd> SimdInt<S> for u16x8<S>

Source§

impl<S: Simd> SimdInt<S> for u16x16<S>

Source§

impl<S: Simd> SimdInt<S> for u16x32<S>

Source§

impl<S: Simd> SimdInt<S> for u32x4<S>

Source§

impl<S: Simd> SimdInt<S> for u32x8<S>

Source§

impl<S: Simd> SimdInt<S> for u32x16<S>