pub trait BitOpswhere
Self: Sized,{
type Inner;
Show 51 methods
// Required methods
fn bit_mask_range(start: u32, end: u32) -> Self;
fn bit_mask_range_checked(
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ;
fn bit_is_set_mask(self, mask: Self::Inner) -> bool;
fn bit_set_mask(self, mask: Self::Inner) -> Self;
fn bit_is_unset_mask(self, mask: Self::Inner) -> bool;
fn bit_unset_mask(self, mask: Self::Inner) -> Self;
fn bit_get_range(self, start: u32, end: u32) -> Self;
fn bit_get_range_checked(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ;
fn bit_get_value_range(self, start: u32, end: u32) -> Self;
fn bit_get_value_range_checked(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ;
fn bit_is_set(self, nth: u32) -> bool;
fn bit_is_set_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ;
fn bit_set(self, nth: u32) -> Self;
fn bit_set_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ;
fn bit_is_set_range(self, start: u32, end: u32) -> bool;
fn bit_is_set_range_checked(
self,
start: u32,
end: u32,
) -> Result<bool, MismatchedBounds> ⓘ;
fn bit_set_range(self, start: u32, end: u32) -> Self;
fn bit_set_range_checked(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ;
fn bit_set_all(self) -> Self;
fn bit_set_value_range(
self,
value: Self::Inner,
start: u32,
end: u32,
) -> Self;
fn bit_set_value_range_checked(
self,
value: Self::Inner,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ;
fn bit_set_value_range_checked_strict(
self,
value: Self::Inner,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ;
fn bit_is_unset(self, nth: u32) -> bool;
fn bit_is_unset_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ;
fn bit_unset(self, nth: u32) -> Self;
fn bit_unset_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ;
fn bit_is_unset_range(self, start: u32, end: u32) -> bool;
fn bit_is_unset_range_checked(
self,
start: u32,
end: u32,
) -> Result<bool, MismatchedBounds> ⓘ;
fn bit_unset_range(self, start: u32, end: u32) -> Self;
fn bit_unset_range_checked(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ;
fn bit_unset_all(self) -> Self;
fn bit_flip(self, nth: u32) -> Self;
fn bit_flip_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ;
fn bit_flip_range(self, start: u32, end: u32) -> Self;
fn bit_flip_range_checked(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ;
fn bit_flip_range_if(self, start: u32, end: u32, cond: bool) -> Self;
fn bit_flip_range_if_checked(
self,
start: u32,
end: u32,
cond: bool,
) -> Result<Self, MismatchedBounds> ⓘ;
fn bit_reverse_range(self, start: u32, end: u32) -> Self;
fn bit_reverse_range_checked(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ;
fn bit_count_ones_range(self, start: u32, end: u32) -> u32;
fn bit_count_ones_range_checked(
self,
start: u32,
end: u32,
) -> Result<u32, MismatchedBounds> ⓘ;
fn bit_count_zeros_range(self, start: u32, end: u32) -> u32;
fn bit_count_zeros_range_checked(
self,
start: u32,
end: u32,
) -> Result<u32, MismatchedBounds> ⓘ;
fn bit_find_first_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ;
fn bit_find_first_one_range_checked(
self,
start: u32,
end: u32,
) -> Result<Option<u32>, MismatchedBounds> ⓘ;
fn bit_find_first_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ;
fn bit_find_first_zero_range_checked(
self,
start: u32,
end: u32,
) -> Result<Option<u32>, MismatchedBounds> ⓘ;
fn bit_find_last_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ;
fn bit_find_last_one_range_checked(
self,
start: u32,
end: u32,
) -> Result<Option<u32>, MismatchedBounds> ⓘ;
fn bit_find_last_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ;
fn bit_find_last_zero_range_checked(
self,
start: u32,
end: u32,
) -> Result<Option<u32>, MismatchedBounds> ⓘ;
}Expand description
Required Associated Types§
Required Methods§
Sourcefn bit_mask_range(start: u32, end: u32) -> Self
fn bit_mask_range(start: u32, end: u32) -> Self
Returns a bitmask of ones from the [start..=end] range.
Sets the rest of the bits to 0.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
§Benchmarks
The current algorithm used can be more than 1 order of magnitude more efficient than a naive loop that sets the individual bits, as well as much more consistant across the spectrum of bitsizes.
The following table shows the compared benchmark for start=0
and end=BITS-1 measured on an i5-8350U CPU @ 1.70 Ghz:
bits current naive
---- ------- --------
128 2.8 ns 163.0 ns
64 2.0 ns 21.6 ns
32 2.4 ns 12.1 ns
16 2.6 ns 7.6 ns
8 2.9 ns 8.4 nsSourcefn bit_mask_range_checked(
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
fn bit_mask_range_checked( start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Returns a bitmask of ones from the checked [start..=end] range.
Sets the rest of the bits to 0.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS
and MismatchedIndices if start > end.
§Benchmarks
The current algorithm used can be more than 1 order of magnitude more efficient than a naive loop that sets the individual bits, as well as much more consistant across the spectrum of bitsizes.
The following table shows the compared benchmark for start=0
and end=BITS-1 measured on an i5-8350U CPU @ 1.70 Ghz:
bits current naive
---- ------- --------
128 3.7 ns 145.0 ns
64 3.2 ns 38.2 ns
32 3.2 ns 9.0 ns
16 3.2 ns 7.0 ns
8 3.1 ns 6.7 nsSourcefn bit_is_set_mask(self, mask: Self::Inner) -> bool
fn bit_is_set_mask(self, mask: Self::Inner) -> bool
Returns true if any bit selected by mask is 1 in self.
Bits not included in mask are ignored.
Sourcefn bit_set_mask(self, mask: Self::Inner) -> Self
fn bit_set_mask(self, mask: Self::Inner) -> Self
Sets all bits selected by mask to 1.
Bits not included in mask are left unchanged.
Sourcefn bit_is_unset_mask(self, mask: Self::Inner) -> bool
fn bit_is_unset_mask(self, mask: Self::Inner) -> bool
Returns true if all bits selected by mask are 0 in self.
Bits not included in mask are ignored.
Sourcefn bit_unset_mask(self, mask: Self::Inner) -> Self
fn bit_unset_mask(self, mask: Self::Inner) -> Self
Sets all bits selected by mask to 0.
Bits not included in mask are left unchanged.
Sourcefn bit_get_range(self, start: u32, end: u32) -> Self
fn bit_get_range(self, start: u32, end: u32) -> Self
Gets the bits in self from the [start..=end] range.
Sets the rest of the bits to 0.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_get_range_checked(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
fn bit_get_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Gets the bits in self from the checked [start..=end] range.
Sets the rest of the bits to 0.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS and
MismatchedIndices if start > end.
Sourcefn bit_get_value_range(self, start: u32, end: u32) -> Self
fn bit_get_value_range(self, start: u32, end: u32) -> Self
Gets the value of the bits in self from the [start..=end] range.
Sets the rest of the bits to 0.
The bits in the specified range are shifted rightwards so that the least significant bit (LSB) aligns with the units place, forming the integer value.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_get_value_range_checked(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
fn bit_get_value_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Gets the value of the bits in self from the checked [start..=end] range.
Sets the rest of the bits to 0.
The bits in the specified range are shifted rightwards so that the least significant bit (LSB) aligns with the units place, forming the integer value.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS and
MismatchedIndices if start > end.
Sourcefn bit_is_set(self, nth: u32) -> bool
fn bit_is_set(self, nth: u32) -> bool
Sourcefn bit_is_set_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
fn bit_is_set_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
Sourcefn bit_set_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
Sourcefn bit_is_set_range(self, start: u32, end: u32) -> bool
fn bit_is_set_range(self, start: u32, end: u32) -> bool
Sets the bits in self to 1, from the [start..=end] range.
Leaves the rest of the bits unchanged.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_is_set_range_checked(
self,
start: u32,
end: u32,
) -> Result<bool, MismatchedBounds> ⓘ
fn bit_is_set_range_checked( self, start: u32, end: u32, ) -> Result<bool, MismatchedBounds> ⓘ
Sets the bits in self to 1, from the checked [start..=end] range.
Leaves the rest of the bits unchanged.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS
and MismatchedIndices if start > end.
Sourcefn bit_set_range(self, start: u32, end: u32) -> Self
fn bit_set_range(self, start: u32, end: u32) -> Self
Sets the bits in self to 1, from the [start..=end] range.
Leaves the rest of the bits unchanged.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_set_range_checked(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Sets the bits in self to 1, from the checked [start..=end] range.
Leaves the rest of the bits unchanged.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS
and MismatchedIndices if start > end.
Sourcefn bit_set_all(self) -> Self
fn bit_set_all(self) -> Self
Sets all the bits to 1.
Sourcefn bit_set_value_range(self, value: Self::Inner, start: u32, end: u32) -> Self
fn bit_set_value_range(self, value: Self::Inner, start: u32, end: u32) -> Self
Sets the given value into the bits from the [start..=end] range.
Leaves the rest of the bits unchanged.
The value is first masked to fit the size of the range, and then
it is inserted into the specified bit range of self, replacing
the existing bits in that range. The rest of the bits in self remain unchanged.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_set_value_range_checked(
self,
value: Self::Inner,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_value_range_checked( self, value: Self::Inner, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Sets the given value into the bits from the checked [start..=end] range.
Leaves the rest of the bits unchanged.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS
and MismatchedIndices if start > end.
Sourcefn bit_set_value_range_checked_strict(
self,
value: Self::Inner,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_value_range_checked_strict( self, value: Self::Inner, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Sets the given checked value into the bits from the checked [start..=end] range.
Leaves the rest of the bits unchanged.
A value fits when it can be represented by end - start + 1 bits.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS,
MismatchedIndices if start > end, and
MismatchedCapacity if value does not fit within the specified bit range.
Sourcefn bit_is_unset(self, nth: u32) -> bool
fn bit_is_unset(self, nth: u32) -> bool
Sourcefn bit_is_unset_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
fn bit_is_unset_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
Sourcefn bit_unset_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_unset_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
Sourcefn bit_is_unset_range(self, start: u32, end: u32) -> bool
fn bit_is_unset_range(self, start: u32, end: u32) -> bool
Unsets the bits in self to 0, from the [start..=end] range.
Leaves the rest of the bits unchanged.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_is_unset_range_checked(
self,
start: u32,
end: u32,
) -> Result<bool, MismatchedBounds> ⓘ
fn bit_is_unset_range_checked( self, start: u32, end: u32, ) -> Result<bool, MismatchedBounds> ⓘ
Unsets the bits in self to 0, from the checked [start..=end] range.
Leaves the rest of the bits unchanged.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS and
MismatchedIndices if start > end.
Sourcefn bit_unset_range(self, start: u32, end: u32) -> Self
fn bit_unset_range(self, start: u32, end: u32) -> Self
Unsets the bits in self to 0, from the [start..=end] range.
Leaves the rest of the bits unchanged.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_unset_range_checked(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
fn bit_unset_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Unsets the bits in self to 0, from the checked [start..=end] range.
Leaves the rest of the bits unchanged.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS and
MismatchedIndices if start > end.
Sourcefn bit_unset_all(self) -> Self
fn bit_unset_all(self) -> Self
Unsets all the bits to 0.
Sourcefn bit_flip_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_flip_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
Sourcefn bit_flip_range(self, start: u32, end: u32) -> Self
fn bit_flip_range(self, start: u32, end: u32) -> Self
Flips the bits in self from the [start..=end] range.
Leaves the rest of the bits unchanged.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_flip_range_checked(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
fn bit_flip_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Flips the bits in self from the checked [start..=end] range.
Leaves the rest of the bits unchanged.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS and
MismatchedIndices if start > end.
Sourcefn bit_flip_range_if(self, start: u32, end: u32, cond: bool) -> Self
fn bit_flip_range_if(self, start: u32, end: u32, cond: bool) -> Self
Conditionally flips bits in a range if cond is true.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_flip_range_if_checked(
self,
start: u32,
end: u32,
cond: bool,
) -> Result<Self, MismatchedBounds> ⓘ
fn bit_flip_range_if_checked( self, start: u32, end: u32, cond: bool, ) -> Result<Self, MismatchedBounds> ⓘ
Conditionally flips bits in a range if cond is true.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS and
MismatchedIndices if start > end.
Sourcefn bit_reverse_range(self, start: u32, end: u32) -> Self
fn bit_reverse_range(self, start: u32, end: u32) -> Self
Reverses the order of the bits in self from the [start..=end] range.
Leaves the rest of the bits unchanged.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_reverse_range_checked(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
fn bit_reverse_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Reverses the order of the bits in self from the checked [start..=end] range.
Leaves the rest of the bits unchanged.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS and
MismatchedIndices if start > end.
Sourcefn bit_count_ones_range(self, start: u32, end: u32) -> u32
fn bit_count_ones_range(self, start: u32, end: u32) -> u32
Counts the number of 1s in self from the [start..=end] range.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_count_ones_range_checked(
self,
start: u32,
end: u32,
) -> Result<u32, MismatchedBounds> ⓘ
fn bit_count_ones_range_checked( self, start: u32, end: u32, ) -> Result<u32, MismatchedBounds> ⓘ
Counts the number of 1s in self from the checked [start..=end] range.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS and
MismatchedIndices if start > end.
Sourcefn bit_count_zeros_range(self, start: u32, end: u32) -> u32
fn bit_count_zeros_range(self, start: u32, end: u32) -> u32
Counts the number of 0s in self from the [start..=end] range.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_count_zeros_range_checked(
self,
start: u32,
end: u32,
) -> Result<u32, MismatchedBounds> ⓘ
fn bit_count_zeros_range_checked( self, start: u32, end: u32, ) -> Result<u32, MismatchedBounds> ⓘ
Counts the number of 0s in self from the checked [start..=end] range.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS and
MismatchedIndices if start > end.
Sourcefn bit_find_first_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_first_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
Finds the index of the first 1 in self from the [start..=end] range.
Returns None if there are no bits set.
The index is relative to the entire sequence of self, not to the given start.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_find_first_one_range_checked(
self,
start: u32,
end: u32,
) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_first_one_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
Finds the index of the first 1 in self from the checked [start..=end] range.
Returns None if there are no bits set.
The index is relative to the entire sequence of self, not to the given start.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS and
MismatchedIndices if start > end.
Sourcefn bit_find_first_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_first_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
Finds the index of the first 0 in self from the [start..=end] range.
Returns None if there are no bits unset.
The index is relative to the entire sequence of self, not to the given start.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_find_first_zero_range_checked(
self,
start: u32,
end: u32,
) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_first_zero_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
Finds the index of the first 0 in self from the checked [start..=end] range.
Returns None if there are no bits unset.
The index is relative to the entire sequence of self, not to the given start.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS and
MismatchedIndices if start > end.
Sourcefn bit_find_last_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_last_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
Finds the index of the last 1 in self from the [start..=end] range.
Returns None if there are no bits set.
The index is relative to the entire sequence of self, not to the given start.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_find_last_one_range_checked(
self,
start: u32,
end: u32,
) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_last_one_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
Finds the index of the last 1 in self from the checked [start..=end] range.
Returns None if there are no bits set.
The index is relative to the entire sequence of self, not to the given start.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS and
MismatchedIndices if start > end.
Sourcefn bit_find_last_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_last_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
Finds the index of the last 0 in self from the [start..=end] range.
Returns None if there are no bits set.
The index is relative to the entire sequence of self, not to the given start.
§Panics
Panics in debug mode if start >= BITS || end >= BITS || start > end.
Sourcefn bit_find_last_zero_range_checked(
self,
start: u32,
end: u32,
) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_last_zero_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
Finds the index of the last 0 in self from the checked [start..=end] range.
Returns None if there are no bits set.
The index is relative to the entire sequence of self, not to the given start.
§Errors
Returns IndexOutOfBounds if start >= BITS || end >= BITS and
MismatchedIndices if start > end.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl BitOps for u8
impl BitOps for u8
Source§fn bit_is_set_mask(self, mask: u8) -> bool
fn bit_is_set_mask(self, mask: u8) -> bool
Returns true if any bit selected by mask is 1 in self.
Bits not included in mask are ignored.
Source§fn bit_set_mask(self, mask: u8) -> Self
fn bit_set_mask(self, mask: u8) -> Self
Sets all bits selected by mask to 1.
Bits not included in mask are left unchanged.
Source§fn bit_is_unset_mask(self, mask: u8) -> bool
fn bit_is_unset_mask(self, mask: u8) -> bool
Returns true if all bits selected by mask are 0 in self.
Bits not included in mask are ignored.
Source§fn bit_unset_mask(self, mask: u8) -> Self
fn bit_unset_mask(self, mask: u8) -> Self
Sets all bits selected by mask to 0.
Bits not included in mask are left unchanged.
type Inner = u8
fn bit_mask_range(start: u32, end: u32) -> Self
fn bit_mask_range_checked( start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_get_range(self, start: u32, end: u32) -> Self
fn bit_get_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_get_value_range(self, start: u32, end: u32) -> Self
fn bit_get_value_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_set(self, nth: u32) -> bool
fn bit_is_set_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
fn bit_set(self, nth: u32) -> Self
fn bit_set_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_set_range(self, start: u32, end: u32) -> bool
fn bit_is_set_range_checked( self, start: u32, end: u32, ) -> Result<bool, MismatchedBounds> ⓘ
fn bit_set_range(self, start: u32, end: u32) -> Self
fn bit_set_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_all(self) -> Self
fn bit_set_value_range(self, value: Self::Inner, start: u32, end: u32) -> Self
fn bit_set_value_range_checked( self, value: Self::Inner, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_value_range_checked_strict( self, value: Self::Inner, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_unset(self, nth: u32) -> bool
fn bit_is_unset_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
fn bit_unset(self, nth: u32) -> Self
fn bit_unset_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_unset_range(self, start: u32, end: u32) -> bool
fn bit_is_unset_range_checked( self, start: u32, end: u32, ) -> Result<bool, MismatchedBounds> ⓘ
fn bit_unset_range(self, start: u32, end: u32) -> Self
fn bit_unset_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_unset_all(self) -> Self
fn bit_flip(self, nth: u32) -> Self
fn bit_flip_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_flip_range(self, start: u32, end: u32) -> Self
fn bit_flip_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_flip_range_if(self, start: u32, end: u32, cond: bool) -> Self
fn bit_flip_range_if_checked( self, start: u32, end: u32, cond: bool, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_reverse_range(self, start: u32, end: u32) -> Self
fn bit_reverse_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_count_ones_range(self, start: u32, end: u32) -> u32
fn bit_count_ones_range_checked( self, start: u32, end: u32, ) -> Result<u32, MismatchedBounds> ⓘ
fn bit_count_zeros_range(self, start: u32, end: u32) -> u32
fn bit_count_zeros_range_checked( self, start: u32, end: u32, ) -> Result<u32, MismatchedBounds> ⓘ
fn bit_find_first_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_first_one_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_first_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_first_zero_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_last_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_last_one_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_last_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_last_zero_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
Source§impl BitOps for u16
impl BitOps for u16
Source§fn bit_is_set_mask(self, mask: u16) -> bool
fn bit_is_set_mask(self, mask: u16) -> bool
Returns true if any bit selected by mask is 1 in self.
Bits not included in mask are ignored.
Source§fn bit_set_mask(self, mask: u16) -> Self
fn bit_set_mask(self, mask: u16) -> Self
Sets all bits selected by mask to 1.
Bits not included in mask are left unchanged.
Source§fn bit_is_unset_mask(self, mask: u16) -> bool
fn bit_is_unset_mask(self, mask: u16) -> bool
Returns true if all bits selected by mask are 0 in self.
Bits not included in mask are ignored.
Source§fn bit_unset_mask(self, mask: u16) -> Self
fn bit_unset_mask(self, mask: u16) -> Self
Sets all bits selected by mask to 0.
Bits not included in mask are left unchanged.
type Inner = u16
fn bit_mask_range(start: u32, end: u32) -> Self
fn bit_mask_range_checked( start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_get_range(self, start: u32, end: u32) -> Self
fn bit_get_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_get_value_range(self, start: u32, end: u32) -> Self
fn bit_get_value_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_set(self, nth: u32) -> bool
fn bit_is_set_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
fn bit_set(self, nth: u32) -> Self
fn bit_set_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_set_range(self, start: u32, end: u32) -> bool
fn bit_is_set_range_checked( self, start: u32, end: u32, ) -> Result<bool, MismatchedBounds> ⓘ
fn bit_set_range(self, start: u32, end: u32) -> Self
fn bit_set_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_all(self) -> Self
fn bit_set_value_range(self, value: Self::Inner, start: u32, end: u32) -> Self
fn bit_set_value_range_checked( self, value: Self::Inner, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_value_range_checked_strict( self, value: Self::Inner, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_unset(self, nth: u32) -> bool
fn bit_is_unset_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
fn bit_unset(self, nth: u32) -> Self
fn bit_unset_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_unset_range(self, start: u32, end: u32) -> bool
fn bit_is_unset_range_checked( self, start: u32, end: u32, ) -> Result<bool, MismatchedBounds> ⓘ
fn bit_unset_range(self, start: u32, end: u32) -> Self
fn bit_unset_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_unset_all(self) -> Self
fn bit_flip(self, nth: u32) -> Self
fn bit_flip_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_flip_range(self, start: u32, end: u32) -> Self
fn bit_flip_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_flip_range_if(self, start: u32, end: u32, cond: bool) -> Self
fn bit_flip_range_if_checked( self, start: u32, end: u32, cond: bool, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_reverse_range(self, start: u32, end: u32) -> Self
fn bit_reverse_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_count_ones_range(self, start: u32, end: u32) -> u32
fn bit_count_ones_range_checked( self, start: u32, end: u32, ) -> Result<u32, MismatchedBounds> ⓘ
fn bit_count_zeros_range(self, start: u32, end: u32) -> u32
fn bit_count_zeros_range_checked( self, start: u32, end: u32, ) -> Result<u32, MismatchedBounds> ⓘ
fn bit_find_first_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_first_one_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_first_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_first_zero_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_last_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_last_one_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_last_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_last_zero_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
Source§impl BitOps for u32
impl BitOps for u32
Source§fn bit_is_set_mask(self, mask: u32) -> bool
fn bit_is_set_mask(self, mask: u32) -> bool
Returns true if any bit selected by mask is 1 in self.
Bits not included in mask are ignored.
Source§fn bit_set_mask(self, mask: u32) -> Self
fn bit_set_mask(self, mask: u32) -> Self
Sets all bits selected by mask to 1.
Bits not included in mask are left unchanged.
Source§fn bit_is_unset_mask(self, mask: u32) -> bool
fn bit_is_unset_mask(self, mask: u32) -> bool
Returns true if all bits selected by mask are 0 in self.
Bits not included in mask are ignored.
Source§fn bit_unset_mask(self, mask: u32) -> Self
fn bit_unset_mask(self, mask: u32) -> Self
Sets all bits selected by mask to 0.
Bits not included in mask are left unchanged.
type Inner = u32
fn bit_mask_range(start: u32, end: u32) -> Self
fn bit_mask_range_checked( start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_get_range(self, start: u32, end: u32) -> Self
fn bit_get_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_get_value_range(self, start: u32, end: u32) -> Self
fn bit_get_value_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_set(self, nth: u32) -> bool
fn bit_is_set_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
fn bit_set(self, nth: u32) -> Self
fn bit_set_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_set_range(self, start: u32, end: u32) -> bool
fn bit_is_set_range_checked( self, start: u32, end: u32, ) -> Result<bool, MismatchedBounds> ⓘ
fn bit_set_range(self, start: u32, end: u32) -> Self
fn bit_set_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_all(self) -> Self
fn bit_set_value_range(self, value: Self::Inner, start: u32, end: u32) -> Self
fn bit_set_value_range_checked( self, value: Self::Inner, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_value_range_checked_strict( self, value: Self::Inner, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_unset(self, nth: u32) -> bool
fn bit_is_unset_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
fn bit_unset(self, nth: u32) -> Self
fn bit_unset_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_unset_range(self, start: u32, end: u32) -> bool
fn bit_is_unset_range_checked( self, start: u32, end: u32, ) -> Result<bool, MismatchedBounds> ⓘ
fn bit_unset_range(self, start: u32, end: u32) -> Self
fn bit_unset_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_unset_all(self) -> Self
fn bit_flip(self, nth: u32) -> Self
fn bit_flip_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_flip_range(self, start: u32, end: u32) -> Self
fn bit_flip_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_flip_range_if(self, start: u32, end: u32, cond: bool) -> Self
fn bit_flip_range_if_checked( self, start: u32, end: u32, cond: bool, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_reverse_range(self, start: u32, end: u32) -> Self
fn bit_reverse_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_count_ones_range(self, start: u32, end: u32) -> u32
fn bit_count_ones_range_checked( self, start: u32, end: u32, ) -> Result<u32, MismatchedBounds> ⓘ
fn bit_count_zeros_range(self, start: u32, end: u32) -> u32
fn bit_count_zeros_range_checked( self, start: u32, end: u32, ) -> Result<u32, MismatchedBounds> ⓘ
fn bit_find_first_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_first_one_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_first_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_first_zero_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_last_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_last_one_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_last_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_last_zero_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
Source§impl BitOps for u64
impl BitOps for u64
Source§fn bit_is_set_mask(self, mask: u64) -> bool
fn bit_is_set_mask(self, mask: u64) -> bool
Returns true if any bit selected by mask is 1 in self.
Bits not included in mask are ignored.
Source§fn bit_set_mask(self, mask: u64) -> Self
fn bit_set_mask(self, mask: u64) -> Self
Sets all bits selected by mask to 1.
Bits not included in mask are left unchanged.
Source§fn bit_is_unset_mask(self, mask: u64) -> bool
fn bit_is_unset_mask(self, mask: u64) -> bool
Returns true if all bits selected by mask are 0 in self.
Bits not included in mask are ignored.
Source§fn bit_unset_mask(self, mask: u64) -> Self
fn bit_unset_mask(self, mask: u64) -> Self
Sets all bits selected by mask to 0.
Bits not included in mask are left unchanged.
type Inner = u64
fn bit_mask_range(start: u32, end: u32) -> Self
fn bit_mask_range_checked( start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_get_range(self, start: u32, end: u32) -> Self
fn bit_get_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_get_value_range(self, start: u32, end: u32) -> Self
fn bit_get_value_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_set(self, nth: u32) -> bool
fn bit_is_set_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
fn bit_set(self, nth: u32) -> Self
fn bit_set_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_set_range(self, start: u32, end: u32) -> bool
fn bit_is_set_range_checked( self, start: u32, end: u32, ) -> Result<bool, MismatchedBounds> ⓘ
fn bit_set_range(self, start: u32, end: u32) -> Self
fn bit_set_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_all(self) -> Self
fn bit_set_value_range(self, value: Self::Inner, start: u32, end: u32) -> Self
fn bit_set_value_range_checked( self, value: Self::Inner, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_value_range_checked_strict( self, value: Self::Inner, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_unset(self, nth: u32) -> bool
fn bit_is_unset_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
fn bit_unset(self, nth: u32) -> Self
fn bit_unset_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_unset_range(self, start: u32, end: u32) -> bool
fn bit_is_unset_range_checked( self, start: u32, end: u32, ) -> Result<bool, MismatchedBounds> ⓘ
fn bit_unset_range(self, start: u32, end: u32) -> Self
fn bit_unset_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_unset_all(self) -> Self
fn bit_flip(self, nth: u32) -> Self
fn bit_flip_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_flip_range(self, start: u32, end: u32) -> Self
fn bit_flip_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_flip_range_if(self, start: u32, end: u32, cond: bool) -> Self
fn bit_flip_range_if_checked( self, start: u32, end: u32, cond: bool, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_reverse_range(self, start: u32, end: u32) -> Self
fn bit_reverse_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_count_ones_range(self, start: u32, end: u32) -> u32
fn bit_count_ones_range_checked( self, start: u32, end: u32, ) -> Result<u32, MismatchedBounds> ⓘ
fn bit_count_zeros_range(self, start: u32, end: u32) -> u32
fn bit_count_zeros_range_checked( self, start: u32, end: u32, ) -> Result<u32, MismatchedBounds> ⓘ
fn bit_find_first_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_first_one_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_first_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_first_zero_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_last_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_last_one_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_last_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_last_zero_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
Source§impl BitOps for u128
impl BitOps for u128
Source§fn bit_is_set_mask(self, mask: u128) -> bool
fn bit_is_set_mask(self, mask: u128) -> bool
Returns true if any bit selected by mask is 1 in self.
Bits not included in mask are ignored.
Source§fn bit_set_mask(self, mask: u128) -> Self
fn bit_set_mask(self, mask: u128) -> Self
Sets all bits selected by mask to 1.
Bits not included in mask are left unchanged.
Source§fn bit_is_unset_mask(self, mask: u128) -> bool
fn bit_is_unset_mask(self, mask: u128) -> bool
Returns true if all bits selected by mask are 0 in self.
Bits not included in mask are ignored.
Source§fn bit_unset_mask(self, mask: u128) -> Self
fn bit_unset_mask(self, mask: u128) -> Self
Sets all bits selected by mask to 0.
Bits not included in mask are left unchanged.
type Inner = u128
fn bit_mask_range(start: u32, end: u32) -> Self
fn bit_mask_range_checked( start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_get_range(self, start: u32, end: u32) -> Self
fn bit_get_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_get_value_range(self, start: u32, end: u32) -> Self
fn bit_get_value_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_set(self, nth: u32) -> bool
fn bit_is_set_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
fn bit_set(self, nth: u32) -> Self
fn bit_set_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_set_range(self, start: u32, end: u32) -> bool
fn bit_is_set_range_checked( self, start: u32, end: u32, ) -> Result<bool, MismatchedBounds> ⓘ
fn bit_set_range(self, start: u32, end: u32) -> Self
fn bit_set_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_all(self) -> Self
fn bit_set_value_range(self, value: Self::Inner, start: u32, end: u32) -> Self
fn bit_set_value_range_checked( self, value: Self::Inner, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_set_value_range_checked_strict( self, value: Self::Inner, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_unset(self, nth: u32) -> bool
fn bit_is_unset_checked(self, nth: u32) -> Result<bool, MismatchedBounds> ⓘ
fn bit_unset(self, nth: u32) -> Self
fn bit_unset_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_is_unset_range(self, start: u32, end: u32) -> bool
fn bit_is_unset_range_checked( self, start: u32, end: u32, ) -> Result<bool, MismatchedBounds> ⓘ
fn bit_unset_range(self, start: u32, end: u32) -> Self
fn bit_unset_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_unset_all(self) -> Self
fn bit_flip(self, nth: u32) -> Self
fn bit_flip_checked(self, nth: u32) -> Result<Self, MismatchedBounds> ⓘ
fn bit_flip_range(self, start: u32, end: u32) -> Self
fn bit_flip_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_flip_range_if(self, start: u32, end: u32, cond: bool) -> Self
fn bit_flip_range_if_checked( self, start: u32, end: u32, cond: bool, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_reverse_range(self, start: u32, end: u32) -> Self
fn bit_reverse_range_checked( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
fn bit_count_ones_range(self, start: u32, end: u32) -> u32
fn bit_count_ones_range_checked( self, start: u32, end: u32, ) -> Result<u32, MismatchedBounds> ⓘ
fn bit_count_zeros_range(self, start: u32, end: u32) -> u32
fn bit_count_zeros_range_checked( self, start: u32, end: u32, ) -> Result<u32, MismatchedBounds> ⓘ
fn bit_find_first_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_first_one_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_first_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_first_zero_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_last_one_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_last_one_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
fn bit_find_last_zero_range(self, start: u32, end: u32) -> Option<u32> ⓘ
fn bit_find_last_zero_range_checked( self, start: u32, end: u32, ) -> Result<Option<u32>, MismatchedBounds> ⓘ
Source§impl BitOps for usize
impl BitOps for usize
Source§fn bit_is_set_mask(self, mask: usize) -> bool
fn bit_is_set_mask(self, mask: usize) -> bool
Returns true if any bit selected by mask is 1 in self.
Bits not included in mask are ignored.
Source§fn bit_set_mask(self, mask: usize) -> Self
fn bit_set_mask(self, mask: usize) -> Self
Sets all bits selected by mask to 1.
Bits not included in mask are left unchanged.
Source§fn bit_is_unset_mask(self, mask: usize) -> bool
fn bit_is_unset_mask(self, mask: usize) -> bool
Returns true if all bits selected by mask are 0 in self.
Bits not included in mask are ignored.
Source§fn bit_unset_mask(self, mask: usize) -> Self
fn bit_unset_mask(self, mask: usize) -> Self
Sets all bits selected by mask to 0.
Bits not included in mask are left unchanged.