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

Trait Implementations

impl Clone for Limb
[src]

fn clone(&self) -> Limb

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

impl Add<Limb> for Limb
[src]

type Output = Limb

fn add(self, other: Limb) -> Limb

impl Add<BaseInt> for Limb
[src]

type Output = Limb

fn add(self, other: BaseInt) -> Limb

impl Add<bool> for Limb
[src]

type Output = Limb

fn add(self, other: bool) -> Limb

impl Sub<Limb> for Limb
[src]

type Output = Limb

fn sub(self, other: Limb) -> Limb

impl Sub<BaseInt> for Limb
[src]

type Output = Limb

fn sub(self, other: BaseInt) -> Limb

impl Sub<bool> for Limb
[src]

type Output = Limb

fn sub(self, other: bool) -> Limb

impl Mul<Limb> for Limb
[src]

type Output = Limb

fn mul(self, other: Limb) -> Limb

impl Mul<BaseInt> for Limb
[src]

type Output = Limb

fn mul(self, other: BaseInt) -> Limb

impl Div<Limb> for Limb
[src]

type Output = Limb

fn div(self, other: Limb) -> Limb

impl Div<BaseInt> for Limb
[src]

type Output = Limb

fn div(self, other: BaseInt) -> Limb

impl Rem<Limb> for Limb
[src]

type Output = Limb

fn rem(self, other: Limb) -> Limb

impl Rem<BaseInt> for Limb
[src]

type Output = Limb

fn rem(self, other: BaseInt) -> Limb

impl Neg for Limb
[src]

type Output = Limb

fn neg(self) -> Limb

impl<I> Shl<I> for Limb where BaseInt: Shl<I, Output=BaseInt>
[src]

type Output = Limb

fn shl(self, other: I) -> Limb

impl<I> Shr<I> for Limb where BaseInt: Shr<I, Output=BaseInt>
[src]

type Output = Limb

fn shr(self, other: I) -> Limb

impl Not for Limb
[src]

type Output = Limb

fn not(self) -> Limb

impl BitAnd<Limb> for Limb
[src]

type Output = Limb

fn bitand(self, other: Limb) -> Limb

impl BitOr<Limb> for Limb
[src]

type Output = Limb

fn bitor(self, other: Limb) -> Limb

impl BitXor<Limb> for Limb
[src]

type Output = Limb

fn bitxor(self, other: Limb) -> Limb

impl PartialEq<Limb> for Limb
[src]

fn eq(&self, other: &Limb) -> bool

fn ne(&self, other: &Limb) -> bool

impl PartialOrd<Limb> for Limb
[src]

fn partial_cmp(&self, other: &Limb) -> Option<Ordering>

fn lt(&self, other: &Limb) -> bool

fn le(&self, other: &Limb) -> bool

fn gt(&self, other: &Limb) -> bool

fn ge(&self, other: &Limb) -> bool

impl PartialEq<BaseInt> for Limb
[src]

fn eq(&self, other: &BaseInt) -> bool

fn ne(&self, other: &BaseInt) -> bool

impl PartialOrd<BaseInt> for Limb
[src]

fn partial_cmp(&self, other: &BaseInt) -> Option<Ordering>

fn lt(&self, other: &BaseInt) -> bool

fn le(&self, other: &BaseInt) -> bool

fn gt(&self, other: &BaseInt) -> bool

fn ge(&self, other: &BaseInt) -> bool

impl Debug for Limb
[src]

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

impl Display for Limb
[src]

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

impl PartialEq<Int> for Limb
[src]

fn eq(&self, other: &Int) -> bool

fn ne(&self, other: &Rhs) -> bool
1.0.0

impl PartialOrd<Int> for Limb
[src]

fn partial_cmp(&self, other: &Int) -> Option<Ordering>

fn lt(&self, other: &Rhs) -> bool
1.0.0

fn le(&self, other: &Rhs) -> bool
1.0.0

fn gt(&self, other: &Rhs) -> bool
1.0.0

fn ge(&self, other: &Rhs) -> bool
1.0.0

Derived Implementations

impl Hash for Limb
[src]

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0

impl Ord for Limb
[src]

fn cmp(&self, __arg_0: &Limb) -> Ordering

impl Eq for Limb
[src]

impl Copy for Limb
[src]