Trait xalloc::int::BinaryInteger
source · pub trait BinaryInteger: Integer + Clone + Sized + AddAssign + SubAssign + MulAssign + DivAssign + BitOrAssign + BitAndAssign + BitXorAssign + BitOr<Self, Output = Self> + BitAnd<Self, Output = Self> + BitXor<Self, Output = Self> + Shl<u32, Output = Self> + Shr<u32, Output = Self> + Not<Output = Self> + RefSaturatingAdd<Output = Self> + Debug {
type OneDigits: Iterator<Item = u32>;
Show 15 methods
fn max_value() -> Self;
fn min_value() -> Self;
fn max_digits() -> u32;
fn ones(range: Range<u32>) -> Self;
fn ones_truncated(range: Range<u32>) -> Self;
fn trailing_zeros(&self) -> u32;
fn leading_zeros(&self) -> u32;
fn count_ones(&self) -> u32;
fn bit_scan_forward(&self, start: u32) -> u32;
fn extract_u32(&self, range: Range<u32>) -> u32;
fn get_bit(&self, i: u32) -> bool;
fn set_bit(&mut self, i: u32);
fn clear_bit(&mut self, i: u32);
fn checked_ceil_fix(self, fp: u32) -> Option<Self>;
fn one_digits(&self) -> Self::OneDigits;
}
Expand description
Integral types with efficient binary operations.
Required Associated Types
Required Methods
fn max_value() -> Self
fn min_value() -> Self
fn max_digits() -> u32
fn ones(range: Range<u32>) -> Self
fn ones_truncated(range: Range<u32>) -> Self
sourcefn trailing_zeros(&self) -> u32
fn trailing_zeros(&self) -> u32
Return the number of trailing zeros in its binary representation.
sourcefn leading_zeros(&self) -> u32
fn leading_zeros(&self) -> u32
Return the number of leading zeros in its binary representation.
sourcefn count_ones(&self) -> u32
fn count_ones(&self) -> u32
Return the number of ones in its binary representation.
sourcefn bit_scan_forward(&self, start: u32) -> u32
fn bit_scan_forward(&self, start: u32) -> u32
Return the position of the least significant set bit since the position
start
.
Retruns Self::max_digits()
if none was found.
sourcefn extract_u32(&self, range: Range<u32>) -> u32
fn extract_u32(&self, range: Range<u32>) -> u32
Slice a part of its binary representation as u32
.
sourcefn checked_ceil_fix(self, fp: u32) -> Option<Self>
fn checked_ceil_fix(self, fp: u32) -> Option<Self>
Perform ceil
treating the value as a fixed point number with fp
fractional part digits.
sourcefn one_digits(&self) -> Self::OneDigits
fn one_digits(&self) -> Self::OneDigits
Get an iterator over set bits, from the least significant bit to the most significant one.