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 Hash for Limb
[src]

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

Feeds this value into the state given, updating the hasher as necessary.

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

Feeds a slice of this type into the state provided.

impl Ord for Limb
[src]

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

This method returns an Ordering between self and other. Read more

impl Eq for Limb
[src]

impl Copy for Limb
[src]

impl Clone for Limb
[src]

fn clone(&self) -> Limb

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Add<Limb> for Limb
[src]

type Output = Limb

The resulting type after applying the + operator

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

The method for the + operator

impl Add<BaseInt> for Limb
[src]

type Output = Limb

The resulting type after applying the + operator

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

The method for the + operator

impl Add<bool> for Limb
[src]

type Output = Limb

The resulting type after applying the + operator

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

The method for the + operator

impl Sub<Limb> for Limb
[src]

type Output = Limb

The resulting type after applying the - operator

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

The method for the - operator

impl Sub<BaseInt> for Limb
[src]

type Output = Limb

The resulting type after applying the - operator

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

The method for the - operator

impl Sub<bool> for Limb
[src]

type Output = Limb

The resulting type after applying the - operator

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

The method for the - operator

impl Mul<Limb> for Limb
[src]

type Output = Limb

The resulting type after applying the * operator

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

The method for the * operator

impl Mul<BaseInt> for Limb
[src]

type Output = Limb

The resulting type after applying the * operator

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

The method for the * operator

impl Div<Limb> for Limb
[src]

type Output = Limb

The resulting type after applying the / operator

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

The method for the / operator

impl Div<BaseInt> for Limb
[src]

type Output = Limb

The resulting type after applying the / operator

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

The method for the / operator

impl Rem<Limb> for Limb
[src]

type Output = Limb

The resulting type after applying the % operator

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

The method for the % operator

impl Rem<BaseInt> for Limb
[src]

type Output = Limb

The resulting type after applying the % operator

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

The method for the % operator

impl Neg for Limb
[src]

type Output = Limb

The resulting type after applying the - operator

fn neg(self) -> Limb

The method for the unary - operator

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

type Output = Limb

The resulting type after applying the << operator

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

The method for the << operator

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

type Output = Limb

The resulting type after applying the >> operator

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

The method for the >> operator

impl Not for Limb
[src]

type Output = Limb

The resulting type after applying the ! operator

fn not(self) -> Limb

The method for the unary ! operator

impl BitAnd<Limb> for Limb
[src]

type Output = Limb

The resulting type after applying the & operator

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

The method for the & operator

impl BitOr<Limb> for Limb
[src]

type Output = Limb

The resulting type after applying the | operator

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

The method for the | operator

impl BitXor<Limb> for Limb
[src]

type Output = Limb

The resulting type after applying the ^ operator

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

The method for the ^ operator

impl PartialEq<Limb> for Limb
[src]

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

This method tests for self and other values to be equal, and is used by ==. Read more

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

This method tests for !=.

impl PartialOrd<Limb> for Limb
[src]

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

This method returns an ordering between self and other values if one exists. Read more

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

This method tests less than (for self and other) and is used by the < operator. Read more

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

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

This method tests greater than (for self and other) and is used by the > operator. Read more

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialEq<BaseInt> for Limb
[src]

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

This method tests for self and other values to be equal, and is used by ==. Read more

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

This method tests for !=.

impl PartialOrd<BaseInt> for Limb
[src]

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

This method returns an ordering between self and other values if one exists. Read more

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

This method tests less than (for self and other) and is used by the < operator. Read more

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

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

This method tests greater than (for self and other) and is used by the > operator. Read more

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Debug for Limb
[src]

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

Formats the value using the given formatter.

impl Display for Limb
[src]

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

Formats the value using the given formatter.

impl PartialEq<Int> for Limb
[src]

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

This method tests for self and other values to be equal, and is used by ==. Read more

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

This method tests for !=.

impl PartialOrd<Int> for Limb
[src]

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

This method returns an ordering between self and other values if one exists. Read more

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

This method tests less than (for self and other) and is used by the < operator. Read more

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

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

This method tests greater than (for self and other) and is used by the > operator. Read more

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more