sonic_simd

Trait BitMask

Source
pub trait BitMask {
    const LEN: usize;

    // Required methods
    fn first_offset(&self) -> usize;
    fn before(&self, rhs: &Self) -> bool;
    fn as_little_endian(&self) -> Self;
    fn all_zero(&self) -> bool;
    fn clear_high_bits(&self, n: usize) -> Self;
}
Expand description

Trait for the bitmask of a vector Mask.

Required Associated Constants§

Source

const LEN: usize

Total bits in the bitmask.

Required Methods§

Source

fn first_offset(&self) -> usize

get the offset of the first 1 bit.

Source

fn before(&self, rhs: &Self) -> bool

check if this bitmask is before the other bitmask.

Source

fn as_little_endian(&self) -> Self

convert bitmask as little endian

Source

fn all_zero(&self) -> bool

whether all bits are zero.

Source

fn clear_high_bits(&self, n: usize) -> Self

clear high n bits.

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.

Implementations on Foreign Types§

Source§

impl BitMask for u16

Source§

const LEN: usize = 16usize

Source§

fn before(&self, rhs: &Self) -> bool

Source§

fn first_offset(&self) -> usize

Source§

fn as_little_endian(&self) -> Self

Source§

fn all_zero(&self) -> bool

Source§

fn clear_high_bits(&self, n: usize) -> Self

Source§

impl BitMask for u32

Source§

const LEN: usize = 32usize

Source§

fn before(&self, rhs: &Self) -> bool

Source§

fn first_offset(&self) -> usize

Source§

fn as_little_endian(&self) -> Self

Source§

fn all_zero(&self) -> bool

Source§

fn clear_high_bits(&self, n: usize) -> Self

Source§

impl BitMask for u64

Source§

const LEN: usize = 64usize

Source§

fn before(&self, rhs: &Self) -> bool

Source§

fn first_offset(&self) -> usize

Source§

fn as_little_endian(&self) -> Self

Source§

fn all_zero(&self) -> bool

Source§

fn clear_high_bits(&self, n: usize) -> Self

Implementors§

Source§

impl BitMask for NeonBits

Source§

const LEN: usize = 16usize