Struct ramp::ll::limb::Limb
[−]
[src]
pub struct Limb(pub BaseInt);
Helper newtype for operations.
A "Limb" is a single digit in base 2word size.
Methods
impl Limb
[src]
const BITS: usize = 64
const B: Limb = Limb(1 << Limb::BITS / 2)
fn high_part(self) -> Limb
Returns the high half of the limb
fn low_part(self) -> Limb
Returns the low half of the limb
fn add_overflow(self, other: Limb) -> (Limb, bool)
Performs self + other
, returning the result and whether or not the addition overflowed
fn sub_overflow(self, other: Limb) -> (Limb, bool)
Performs self - other
, returning the result and whether or not the subtraction overflowed
fn mul_lo(self, other: Limb) -> Limb
Performs self * other
returning the lower half of the product
fn mul_hi(self, other: Limb) -> Limb
Performs self * other
returning the higher half of the product
fn mul_hilo(self, other: Limb) -> (Limb, Limb)
Performs self * other
returning the two-limb result as (high, low).
fn invert(self) -> Limb
fn high_bit_set(self) -> bool
Returns whether or not the highest bit in the limb is set.
Division algorithms often require the highest limb of the divisor
to be d >= BASE/2
.
fn leading_zeros(self) -> BaseInt
Returns the number of leading zeros in the limb
fn trailing_zeros(self) -> BaseInt
Returns the number of trailing zeros in the limb