Struct memchr::vector::SensibleMoveMask

source ·
pub(crate) struct SensibleMoveMask(u32);
Expand description

This is a “sensible” movemask implementation where each bit represents whether the most significant bit is set in each corresponding lane of a vector. This is used on x86-64 and wasm, but such a mask is more expensive to get on aarch64 so we use something a little different.

We call this “sensible” because this is what we get using native sse/avx movemask instructions. But neon has no such native equivalent.

Tuple Fields§

§0: u32

Implementations§

source§

impl SensibleMoveMask

source

fn get_for_offset(self) -> u32

Get the mask in a form suitable for computing offsets.

Basically, this normalizes to little endian. On big endian, this swaps the bytes.

Trait Implementations§

source§

impl Clone for SensibleMoveMask

source§

fn clone(&self) -> SensibleMoveMask

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SensibleMoveMask

source§

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

Formats the value using the given formatter. Read more
source§

impl MoveMask for SensibleMoveMask

source§

fn all_zeros_except_least_significant(n: usize) -> SensibleMoveMask

Return a mask that is all zeros except for the least significant n lanes in a corresponding vector.
source§

fn has_non_zero(self) -> bool

Returns true if and only if this mask has a a non-zero bit anywhere.
source§

fn count_ones(self) -> usize

Returns the number of bits set to 1 in this mask.
source§

fn and(self, other: SensibleMoveMask) -> SensibleMoveMask

Does a bitwise and operation between self and other.
source§

fn or(self, other: SensibleMoveMask) -> SensibleMoveMask

Does a bitwise or operation between self and other.
source§

fn clear_least_significant_bit(self) -> SensibleMoveMask

Returns a mask that is equivalent to self but with the least significant 1-bit set to 0.
source§

fn first_offset(self) -> usize

Returns the offset of the first non-zero lane this mask represents.
source§

fn last_offset(self) -> usize

Returns the offset of the last non-zero lane this mask represents.
source§

impl Copy for SensibleMoveMask

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

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

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

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

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.