snarkvm_utilities::biginteger

Trait BigInteger

Source
pub trait BigInteger:
    ToBits
    + FromBits
    + ToBytes
    + FromBytes
    + Copy
    + Clone
    + Debug
    + Default
    + Display
    + Eq
    + Ord
    + Send
    + Sized
    + Sync
    + 'static
    + Uniform
    + AsMut<[u64]>
    + AsRef<[u64]>
    + From<u64> {
    const NUM_LIMBS: usize;
Show 13 methods // Required methods fn add_nocarry(&mut self, other: &Self) -> bool; fn sub_noborrow(&mut self, other: &Self) -> bool; fn mul2(&mut self); fn muln(&mut self, amt: u32); fn div2(&mut self); fn divn(&mut self, amt: u32); fn is_odd(&self) -> bool; fn is_even(&self) -> bool; fn is_zero(&self) -> bool; fn num_bits(&self) -> u32; fn get_bit(&self, i: usize) -> bool; fn to_biguint(&self) -> BigUint; fn find_wnaf(&self) -> Vec<i64>;
}
Expand description

This defines a BigInteger, a smart wrapper around a sequence of u64 limbs, least-significant digit first.

Required Associated Constants§

Source

const NUM_LIMBS: usize

The number of limbs used in this BigInteger.

Required Methods§

Source

fn add_nocarry(&mut self, other: &Self) -> bool

Add another representation to this one, returning the carry bit.

Source

fn sub_noborrow(&mut self, other: &Self) -> bool

Subtract another representation from this one, returning the borrow bit.

Source

fn mul2(&mut self)

Performs a leftwise bitshift of this number, effectively multiplying it by 2. Overflow is ignored.

Source

fn muln(&mut self, amt: u32)

Performs a leftwise bitshift of this number by some amount.

Source

fn div2(&mut self)

Performs a rightwise bitshift of this number, effectively dividing it by 2.

Source

fn divn(&mut self, amt: u32)

Performs a rightwise bitshift of this number by some amount.

Source

fn is_odd(&self) -> bool

Returns true iff this number is odd.

Source

fn is_even(&self) -> bool

Returns true if this number is even.

Source

fn is_zero(&self) -> bool

Returns true if this number is zero.

Source

fn num_bits(&self) -> u32

Compute the number of bits needed to encode this number. Always a multiple of 64.

Source

fn get_bit(&self, i: usize) -> bool

Compute the i-th bit of self.

Source

fn to_biguint(&self) -> BigUint

Returns the BigUint representation.

Source

fn find_wnaf(&self) -> Vec<i64>

Returns a vector for wnaf.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§