pub(crate) struct BitMask(pub(crate) u16);
Expand description
A bit mask which contains the result of a Match
operation on a Group
and
allows iterating through them.
The bit mask is arranged so that low-order bits represent lower memory addresses for group match results.
For implementation reasons, the bits in the set may be sparsely packed with
groups of 8 bits representing one element. If any of these bits are non-zero
then this element is considered to true in the mask. If this is the
case, BITMASK_STRIDE
will be 8 to indicate a divide-by-8 should be
performed on counts/indices to normalize this difference. BITMASK_MASK
is
similarly a mask of all the actually-used bits.
To iterate over a bit mask, it must be converted to a form where only 1 bit
is set per element. This is done by applying BITMASK_ITER_MASK
on the
mask bits.
Tuple Fields§
§0: u16
Implementations§
source§impl BitMask
impl BitMask
sourcefn remove_lowest_bit(self) -> Self
fn remove_lowest_bit(self) -> Self
Returns a new BitMask
with the lowest bit removed.
sourcepub(crate) fn any_bit_set(self) -> bool
pub(crate) fn any_bit_set(self) -> bool
Returns whether the BitMask
has at least one set bit.
sourcepub(crate) fn lowest_set_bit(self) -> Option<usize>
pub(crate) fn lowest_set_bit(self) -> Option<usize>
Returns the first set bit in the BitMask
, if there is one.
sourcepub(crate) fn trailing_zeros(self) -> usize
pub(crate) fn trailing_zeros(self) -> usize
Returns the number of trailing zeroes in the BitMask
.
sourcefn nonzero_trailing_zeros(nonzero: NonZeroU16) -> usize
fn nonzero_trailing_zeros(nonzero: NonZeroU16) -> usize
Same as above but takes a NonZeroBitMaskWord
.
sourcepub(crate) fn leading_zeros(self) -> usize
pub(crate) fn leading_zeros(self) -> usize
Returns the number of leading zeroes in the BitMask
.