Struct u8x32

#[repr(C, align(32))]
pub struct u8x32<S: Simd> { pub simd: S, /* private fields */ }

A SIMD vector of 32 u8 elements.

This type's memory layout is identical to that of [u8; 32], except that it is aligned to 32 bytes.

You may construct this vector type using the Self::splat, Self::from_slice, Self::simd_from, Self::from_fn, and Self::block_splat methods.

# use fearless_simd::{prelude::*, u8x32};
fn construct_simd<S: Simd>(simd: S) {
    // From a single scalar value:
    let a = u8x32::splat(simd, 1);
    let b = u8x32::simd_from(simd, 1);

    // From a slice:
    let c = u8x32::from_slice(simd, &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]);

    // From an array:
    let d = u8x32::simd_from(simd, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]);

    // From an element-wise function:
    let e = u8x32::from_fn(simd, |i| i as u8);
    # use fearless_simd::u8x16;
    // From `Self::Block`:
    let f = u8x32::block_splat(u8x16::simd_from(simd, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]));
}

Fields

simd: S

Trait Implementations

impl<S: Clone + Simd> Clone for u8x32<S> where S::u8x32: Clone,

fn clone(&self) -> Self

impl<S: Copy + Simd> Copy for u8x32<S> where S::u8x32: Copy,

impl<S: Simd + Debug> Debug for u8x32<S>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

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

type Output = u8x32<S>;
fn add(self, rhs: Self) -> Self::Output

Add two vectors element-wise, wrapping on overflow.

impl<S: Simd> Add<u8> for u8x32<S>

type Output = u8x32<S>;
fn add(self, rhs: u8) -> Self::Output

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

fn add_assign(&mut self, rhs: Self)

Add two vectors element-wise, wrapping on overflow.

impl<S: Simd> AddAssign<u8> for u8x32<S>

fn add_assign(&mut self, rhs: u8)

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

type Output = u8x32<S>;
fn bitand(self, rhs: Self) -> Self::Output

Compute the bitwise AND of two vectors.

impl<S: Simd> BitAnd<u8> for u8x32<S>

type Output = u8x32<S>;
fn bitand(self, rhs: u8) -> Self::Output

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

fn bitand_assign(&mut self, rhs: Self)

Compute the bitwise AND of two vectors.

impl<S: Simd> BitAndAssign<u8> for u8x32<S>

fn bitand_assign(&mut self, rhs: u8)

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

type Output = u8x32<S>;
fn bitor(self, rhs: Self) -> Self::Output

Compute the bitwise OR of two vectors.

impl<S: Simd> BitOr<u8> for u8x32<S>

type Output = u8x32<S>;
fn bitor(self, rhs: u8) -> Self::Output

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

fn bitor_assign(&mut self, rhs: Self)

Compute the bitwise OR of two vectors.

impl<S: Simd> BitOrAssign<u8> for u8x32<S>

fn bitor_assign(&mut self, rhs: u8)

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

type Output = u8x32<S>;
fn bitxor(self, rhs: Self) -> Self::Output

Compute the bitwise XOR of two vectors.

impl<S: Simd> BitXor<u8> for u8x32<S>

type Output = u8x32<S>;
fn bitxor(self, rhs: u8) -> Self::Output

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

fn bitxor_assign(&mut self, rhs: Self)

Compute the bitwise XOR of two vectors.

impl<S: Simd> BitXorAssign<u8> for u8x32<S>

fn bitxor_assign(&mut self, rhs: u8)

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

type Bytes = u8x32<S>;
fn to_bytes(self) -> Self::Bytes
fn from_bytes(value: Self::Bytes) -> Self

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

type Target = [u8; 32];
fn deref(&self) -> &Self::Target

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

fn deref_mut(&mut self) -> &mut Self::Target

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

type S = S;
fn token(&self) -> S

impl<S: Simd> Index<usize> for u8x32<S>

type Output = u8;
fn index(&self, i: usize) -> &Self::Output

impl<S: Simd> IndexMut<usize> for u8x32<S>

fn index_mut(&mut self, i: usize) -> &mut Self::Output

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

type Output = u8x32<S>;
fn mul(self, rhs: Self) -> Self::Output

Multiply two vectors element-wise, wrapping on overflow.

impl<S: Simd> Mul<u8> for u8x32<S>

type Output = u8x32<S>;
fn mul(self, rhs: u8) -> Self::Output

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

fn mul_assign(&mut self, rhs: Self)

Multiply two vectors element-wise, wrapping on overflow.

impl<S: Simd> MulAssign<u8> for u8x32<S>

fn mul_assign(&mut self, rhs: u8)

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

type Output = u8x32<S>;
fn not(self) -> Self::Output

Compute the bitwise NOT of the vector.

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

type Output = u8x32<S>;
fn shl(self, rhs: Self) -> Self::Output

Shift each element left by the given number of bits.

Bits shifted out of the left side are discarded, and zeros are shifted in on the right.

When shifting out of bounds (e.g. shifting a 32-bit value by 32 or more), the result is implementation-defined and may vary by platform.

Performance

This per-lane shift is slower than shifting the entire vector by a scalar. It is not vectorized at all on WebAssembly, SSE4.2, and for u8 and i8 elements on AVX2. Prefer shifting by a single scalar value instead of by a vector whenever possible.

impl<S: Simd> Shl<u32> for u8x32<S>

type Output = u8x32<S>;
fn shl(self, rhs: u32) -> Self::Output

Shift each element left by the given number of bits.

Bits shifted out of the left side are discarded, and zeros are shifted in on the right.

When shifting out of bounds (e.g. shifting a 32-bit value by 32 or more), the result is implementation-defined and may vary by platform.

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

fn shl_assign(&mut self, rhs: Self)

Shift each element left by the given number of bits.

Bits shifted out of the left side are discarded, and zeros are shifted in on the right.

When shifting out of bounds (e.g. shifting a 32-bit value by 32 or more), the result is implementation-defined and may vary by platform.

Performance

This per-lane shift is slower than shifting the entire vector by a scalar. It is not vectorized at all on WebAssembly, SSE4.2, and for u8 and i8 elements on AVX2. Prefer shifting by a single scalar value instead of by a vector whenever possible.

impl<S: Simd> ShlAssign<u32> for u8x32<S>

fn shl_assign(&mut self, rhs: u32)

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

type Output = u8x32<S>;
fn shr(self, rhs: Self) -> Self::Output

Shift each element right by the corresponding element in another vector.

For unsigned integers, zeros are shifted in on the left. For signed integers, the sign bit is replicated.

When shifting out of bounds (e.g. shifting a 32-bit value by 32 or more), the result is implementation-defined and may vary by platform.

Performance

This per-lane shift is slower than shifting the entire vector by a scalar. It is not vectorized at all on WebAssembly, SSE4.2, and for u8 and i8 elements on AVX2. Prefer shifting by a single scalar value instead of by a vector whenever possible.

impl<S: Simd> Shr<u32> for u8x32<S>

type Output = u8x32<S>;
fn shr(self, rhs: u32) -> Self::Output

Shift each element right by the given number of bits.

For unsigned integers, zeros are shifted in on the left. For signed integers, the sign bit is replicated.

When shifting out of bounds (e.g. shifting a 32-bit value by 32 or more), the result is implementation-defined and may vary by platform.

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

fn shr_assign(&mut self, rhs: Self)

Shift each element right by the corresponding element in another vector.

For unsigned integers, zeros are shifted in on the left. For signed integers, the sign bit is replicated.

When shifting out of bounds (e.g. shifting a 32-bit value by 32 or more), the result is implementation-defined and may vary by platform.

Performance

This per-lane shift is slower than shifting the entire vector by a scalar. It is not vectorized at all on WebAssembly, SSE4.2, and for u8 and i8 elements on AVX2. Prefer shifting by a single scalar value instead of by a vector whenever possible.

impl<S: Simd> ShrAssign<u32> for u8x32<S>

fn shr_assign(&mut self, rhs: u32)

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

type Element = u8;
type ByteVector = u8x32<S>;
const LEN: usize = 32;
type Mask = mask8x32<S>;
type Block = u8x16<S>;
type Array = [u8; 32];
fn as_slice(&self) -> &[u8]
fn as_mut_slice(&mut self) -> &mut [u8]
fn from_slice(simd: S, slice: &[u8]) -> Self
fn store_slice(&self, slice: &mut [u8])
fn splat(simd: S, val: u8) -> Self
fn block_splat(block: Self::Block) -> Self
fn from_fn(simd: S, f: impl FnMut(usize) -> u8) -> Self
fn slide<const SHIFT: usize>(self, rhs: impl SimdInto<Self, S>) -> Self
fn slide_within_blocks<const SHIFT: usize>(self, rhs: impl SimdInto<Self, S>) -> Self
fn swizzle_dyn_within_blocks(self, indices: impl SimdInto<Self::Bytes, S>) -> Self
fn swizzle_dyn(self, indices: impl SimdInto<Self::Bytes, S>) -> Self
fn swizzle_dyn_precise(self, indices: impl SimdInto<Self::Bytes, S>) -> Self
fn abs(self) -> Self
fn reverse(self) -> Self
fn concat_swizzle_dyn(self, rhs: impl SimdInto<Self, S>, indices: impl SimdInto<Self::Bytes, S>) -> Self
fn concat_swizzle_dyn_precise(self, rhs: impl SimdInto<Self, S>, indices: impl SimdInto<Self::Bytes, S>) -> Self
fn compress(self, mask: Self::Mask) -> Self
fn compress_merge(self, mask: Self::Mask, merge: impl SimdInto<Self, S>) -> Self
fn expand(self, mask: Self::Mask) -> Self
fn expand_merge(self, mask: Self::Mask, merge: impl SimdInto<Self, S>) -> Self
fn reduce_max(self) -> Self::Element
fn reduce_min(self) -> Self::Element
fn reduce_max_precise(self) -> Self::Element
fn reduce_min_precise(self) -> Self::Element
fn reduce_sum(self) -> Self::Element
fn reduce_product(self) -> Self::Element
fn max(self, rhs: impl SimdInto<Self, S>) -> Self
fn min(self, rhs: impl SimdInto<Self, S>) -> Self
fn max_precise(self, rhs: impl SimdInto<Self, S>) -> Self
fn min_precise(self, rhs: impl SimdInto<Self, S>) -> Self
fn clamp(self, min: impl SimdInto<Self, S>, max: impl SimdInto<Self, S>) -> Self
fn simd_eq(self, rhs: impl SimdInto<Self, S>) -> Self::Mask
fn simd_ne(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)

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

type Combined = u8x64<S>;
fn combine(self, rhs: impl SimdInto<Self, S>) -> Self::Combined

impl<S: Simd> SimdFrom<[u8; 32], S> for u8x32<S>

fn simd_from(simd: S, val: [u8; 32]) -> Self

impl<S: Simd> SimdFrom<__m256i, S> for u8x32<S>

fn simd_from(simd: S, arch: __m256i) -> Self

impl<S: Simd> SimdFrom<u8, S> for u8x32<S>

fn simd_from(simd: S, value: u8) -> Self

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

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

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

fn widening_mul(self, rhs: impl SimdInto<Self, S>) -> (Self::Widened, Self::Widened)
fn widening_add(self, rhs: impl SimdInto<Self, S>) -> (Self::Widened, Self::Widened)
fn pairwise_widening_add(self) -> Self::Widened
fn pairwise_dot_product(self, rhs: impl SimdInto<Self, S>) -> Self::Widened

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

type Split = u8x16<S>;
fn split(self) -> (Self::Split, Self::Split)

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

type Widened = u16x16<S>;
fn widen(self) -> (Self::Widened, Self::Widened)

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

type Output = u8x32<S>;
fn sub(self, rhs: Self) -> Self::Output

Subtract two vectors element-wise, wrapping on overflow.

impl<S: Simd> Sub<u8> for u8x32<S>

type Output = u8x32<S>;
fn sub(self, rhs: u8) -> Self::Output

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

fn sub_assign(&mut self, rhs: Self)

Subtract two vectors element-wise, wrapping on overflow.

impl<S: Simd> SubAssign<u8> for u8x32<S>

fn sub_assign(&mut self, rhs: u8)

Auto Trait Implementations

impl<S> Freeze for u8x32<S> where <S as ArchTypes>::u8x32: Freeze, S: Freeze,

impl<S> RefUnwindSafe for u8x32<S> where <S as ArchTypes>::u8x32: RefUnwindSafe, S: RefUnwindSafe,

impl<S> Send for u8x32<S> where <S as ArchTypes>::u8x32: Send,

impl<S> Sync for u8x32<S> where <S as ArchTypes>::u8x32: Sync,

impl<S> Unpin for u8x32<S> where <S as ArchTypes>::u8x32: Unpin, S: Unpin,

impl<S> UnsafeUnpin for u8x32<S> where <S as ArchTypes>::u8x32: UnsafeUnpin, S: UnsafeUnpin,

impl<S> UnwindSafe for u8x32<S> where <S as ArchTypes>::u8x32: UnwindSafe, S: UnwindSafe,

Blanket Implementations

impl<F, T, S> SimdInto<T, S> for u8x32<S> where T: SimdFrom<F, S>, S: Simd,

impl<P, T> Receiver for u8x32<S> where P: Deref<Target = T> + ?Sized, T: ?Sized,

impl<T> Any for u8x32<S> where T: 'static + ?Sized,

impl<T> Borrow<T> for u8x32<S> where T: ?Sized,

impl<T> BorrowMut<T> for u8x32<S> where T: ?Sized,

impl<T> CloneToUninit for u8x32<S> where T: Clone,

impl<T> From<T> for u8x32<S>

impl<T> ToOwned for u8x32<S> where T: Clone,

impl<T, S> SimdFrom<T, S> for u8x32<S> where S: Simd,

impl<T, U> Into<U> for u8x32<S> where U: From<T>,

impl<T, U> TryFrom<U> for u8x32<S> where U: Into<T>,

impl<T, U> TryInto<U> for u8x32<S> where U: TryFrom<T>,