Trait lav::SimdBits

source ·
pub trait SimdBits<B: Bits, const N: usize>
where LaneCount<N>: SupportedLaneCount, for<'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a> Self: Send + Sync + Clone + Copy + Default + PartialEq + Eq + PartialOrd + Ord + From<Simd<B, N>> + Into<Simd<B, N>> + From<[B; N]> + Into<[B; N]> + AsRef<[B; N]> + AsMut<[B; N]> + Product<Self> + Sum<Self> + Product<&'a Self> + Sum<&'a Self> + Hash + Debug + Index<usize, Output = B> + IndexMut<usize, Output = B> + Select<Self::Mask> + Add<Output = Self> + AddAssign + Sub<Output = Self> + SubAssign + Mul<Output = Self> + MulAssign + Div<Output = Self> + DivAssign + Rem<Output = Self> + RemAssign + Shl<Output = Self> + ShlAssign + Shr<Output = Self> + ShrAssign + BitAnd<Output = Self> + BitAndAssign + BitOr<Output = Self> + BitOrAssign + BitXor<Output = Self> + BitXorAssign + Add<&'a Self, Output = Self> + AddAssign<&'a Self> + Sub<&'a Self, Output = Self> + SubAssign<&'a Self> + Mul<&'a Self, Output = Self> + MulAssign<&'a Self> + Div<&'a Self, Output = Self> + DivAssign<&'a Self> + Rem<&'a Self, Output = Self> + RemAssign<&'a Self> + Shl<&'a Self, Output = Self> + ShlAssign<&'a Self> + Shr<&'a Self, Output = Self> + ShrAssign<&'a Self> + BitAnd<&'a Self, Output = Self> + BitAndAssign<&'a Self> + BitOr<&'a Self, Output = Self> + BitOrAssign<&'a Self> + BitXor<&'a Self, Output = Self> + BitXorAssign<&'a Self> + Not<Output = Self>,
{ type Mask: SimdMask<N>; const N: usize = N;
Show 13 methods // Required methods fn splat(value: B) -> Self; fn as_simd(slice: &[B]) -> (&[B], &[Self], &[B]); fn as_simd_mut(slice: &mut [B]) -> (&mut [B], &mut [Self], &mut [B]); fn simd_eq(self, other: Self) -> Self::Mask; fn simd_ne(self, other: Self) -> Self::Mask; fn simd_lt(self, other: Self) -> Self::Mask; fn simd_gt(self, other: Self) -> Self::Mask; fn simd_le(self, other: Self) -> Self::Mask; fn simd_ge(self, other: Self) -> Self::Mask; fn saturating_add(self, other: Self) -> Self; fn saturating_sub(self, other: Self) -> Self; // Provided methods fn len(&self) -> usize { ... } fn abs_sub(self, other: Self) -> Self { ... }
}
Expand description

Bits representation vector of SimdReal vector with associated SimdMask vector.

Required Associated Types§

source

type Mask: SimdMask<N>

Associated mask vector.

Provided Associated Constants§

source

const N: usize = N

Number of lanes in this vector.

Required Methods§

source

fn splat(value: B) -> Self

Constructs a SIMD vector by setting all lanes to the given value.

source

fn as_simd(slice: &[B]) -> (&[B], &[Self], &[B])

Split a slice into a prefix, a middle of aligned SIMD vectors, and a suffix.

You’re only assured thatcself.len() == prefix.len() + middle.len() * N + suffix.len().

Notably, all of the following are possible:

  • prefix.len() >= N,
  • middle.is_empty() despite self.len() >= 3 * N,
  • suffix.len() >= N.

That said, this is a safe method, so if you’re only writing safe code, then this can at most cause incorrect logic, not unsoundness.

§Panics

Panic if the size of the SIMD vector is different from N times that of the scalar.

source

fn as_simd_mut(slice: &mut [B]) -> (&mut [B], &mut [Self], &mut [B])

Split a mutable slice into a mutable prefix, a middle of aligned SIMD vectors, and a mutable suffix.

You’re only assured that self.len() == prefix.len() + middle.len() * N + suffix.len().

Notably, all of the following are possible:

  • prefix.len() >= N,
  • middle.is_empty() despite self.len() >= 3 * N,
  • suffix.len() >= N.

That said, this is a safe method, so if you’re only writing safe code, then this can at most cause incorrect logic, not unsoundness.

This is the mutable version of Self::as_simd.

§Panics

Panic if the size of the SIMD vector is different from N times that of the scalar.

source

fn simd_eq(self, other: Self) -> Self::Mask

Test if each lane is equal to the corresponding lane in other.

source

fn simd_ne(self, other: Self) -> Self::Mask

Test if each lane is not equal to the corresponding lane in other.

source

fn simd_lt(self, other: Self) -> Self::Mask

Test if each lane is less than the corresponding lane in other.

source

fn simd_gt(self, other: Self) -> Self::Mask

Test if each lane is greater than the corresponding lane in other.

source

fn simd_le(self, other: Self) -> Self::Mask

Test if each lane is less than or equal to the corresponding lane in other.

source

fn simd_ge(self, other: Self) -> Self::Mask

Test if each lane is greater than or equal to the corresponding lane in other.

source

fn saturating_add(self, other: Self) -> Self

Lanewise saturating add.

source

fn saturating_sub(self, other: Self) -> Self

Lanewise saturating subtract.

Provided Methods§

source

fn len(&self) -> usize

Get the number of lanes in this vector.

source

fn abs_sub(self, other: Self) -> Self

Lanewise absolute subtract.

Equals self.saturating_sub(other) | other.saturating_sub(self).

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<const N: usize> SimdBits<u32, N> for Simd<u32, N>

§

type Mask = Mask<i32, N>

source§

fn splat(value: u32) -> Self

source§

fn as_simd(slice: &[u32]) -> (&[u32], &[Self], &[u32])

source§

fn as_simd_mut(slice: &mut [u32]) -> (&mut [u32], &mut [Self], &mut [u32])

source§

fn simd_eq(self, other: Self) -> Self::Mask

source§

fn simd_ne(self, other: Self) -> Self::Mask

source§

fn simd_lt(self, other: Self) -> Self::Mask

source§

fn simd_gt(self, other: Self) -> Self::Mask

source§

fn simd_le(self, other: Self) -> Self::Mask

source§

fn simd_ge(self, other: Self) -> Self::Mask

source§

fn saturating_add(self, other: Self) -> Self

source§

fn saturating_sub(self, other: Self) -> Self

source§

impl<const N: usize> SimdBits<u64, N> for Simd<u64, N>

§

type Mask = Mask<i64, N>

source§

fn splat(value: u64) -> Self

source§

fn as_simd(slice: &[u64]) -> (&[u64], &[Self], &[u64])

source§

fn as_simd_mut(slice: &mut [u64]) -> (&mut [u64], &mut [Self], &mut [u64])

source§

fn simd_eq(self, other: Self) -> Self::Mask

source§

fn simd_ne(self, other: Self) -> Self::Mask

source§

fn simd_lt(self, other: Self) -> Self::Mask

source§

fn simd_gt(self, other: Self) -> Self::Mask

source§

fn simd_le(self, other: Self) -> Self::Mask

source§

fn simd_ge(self, other: Self) -> Self::Mask

source§

fn saturating_add(self, other: Self) -> Self

source§

fn saturating_sub(self, other: Self) -> Self

Implementors§