Trait SimdBase8

Source
pub trait SimdBase8: SimdBase + SimdSaturatingArithmetic
where Self::Scalar: Scalar<Unsigned = u8, Signed = i8>,
{ // Required methods fn shift_bytes_left<const AMOUNT: usize>(&self) -> Self; fn shift_bytes_right<const AMOUNT: usize>(&self) -> Self; fn most_significant_bits(&self) -> u32; }
Expand description

A vector containing 8-bit values.

Required Methods§

Source

fn shift_bytes_left<const AMOUNT: usize>(&self) -> Self

Split the vector into groups of 16 bytes. Within each group, shift the entire bytes left by AMOUNT.

§Example
assert_eq!(
    U8x16::from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]).shift_bytes_left::<1>(),
    U8x16::from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),
);
Source

fn shift_bytes_right<const AMOUNT: usize>(&self) -> Self

Split the vector into groups of 16 bytes. Within each group, shift the entire bytes right by AMOUNT.

§Example
assert_eq!(
    U8x16::from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]).shift_bytes_right::<1>(),
    U8x16::from([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]),
);
Source

fn most_significant_bits(&self) -> u32

Get the sign/most significant bits of the elements of the vector.

§Example
assert_eq!(
    (U8x16::from([0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1]) << 7).most_significant_bits(),
    0b1111001001010000,
);

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§