[−][src]Trait snarkos_utilities::biginteger::biginteger::BigInteger
This defines a BigInteger
, a smart wrapper around a
sequence of u64
limbs, least-significant digit first.
Required methods
fn add_nocarry(&mut self, other: &Self) -> bool
Add another representation to this one, returning the carry bit.
fn sub_noborrow(&mut self, other: &Self) -> bool
Subtract another representation from this one, returning the borrow bit.
fn mul2(&mut self)
Performs a leftwise bitshift of this number, effectively multiplying it by 2. Overflow is ignored.
fn muln(&mut self, amt: u32)
Performs a leftwise bitshift of this number by some amount.
fn div2(&mut self)
Performs a rightwise bitshift of this number, effectively dividing it by 2.
fn divn(&mut self, amt: u32)
Performs a rightwise bitshift of this number by some amount.
fn is_odd(&self) -> bool
Returns true iff this number is odd.
fn is_even(&self) -> bool
Returns true iff this number is even.
fn is_zero(&self) -> bool
Returns true iff this number is zero.
fn num_bits(&self) -> u32
Compute the number of bits needed to encode this number. Always a multiple of 64.
fn get_bit(&self, i: usize) -> bool
Compute the i
-th bit of self
.
fn from_bits(bits: &[bool]) -> Self
Returns the big integer representation of a given big endian boolean array.
fn to_bits(&self) -> Vec<bool>ⓘ
Returns the bit representation in a big endian boolean array, without leading zeros.
fn find_wnaf(&self) -> Vec<i64>ⓘ
Returns a vector for wnaf.
Provided methods
fn write_le<W: Write>(&self, writer: &mut W) -> IoResult<()>
Writes this BigInteger
as a big endian integer. Always writes
(num_bits
/ 8) bytes.
fn read_le<R: Read>(&mut self, reader: &mut R) -> IoResult<()>
Reads a big endian integer occupying (num_bits
/ 8) bytes into this
representation.
Implementors
impl BigInteger for BigInteger64
[src]
fn add_nocarry(&mut self, other: &Self) -> bool
[src]
fn sub_noborrow(&mut self, other: &Self) -> bool
[src]
fn mul2(&mut self)
[src]
fn muln(&mut self, n: u32)
[src]
fn div2(&mut self)
[src]
fn divn(&mut self, n: u32)
[src]
fn is_odd(&self) -> bool
[src]
fn is_even(&self) -> bool
[src]
fn is_zero(&self) -> bool
[src]
fn num_bits(&self) -> u32
[src]
fn get_bit(&self, i: usize) -> bool
[src]
fn from_bits(bits: &[bool]) -> Self
[src]
Constructs a BigInteger
by parsing a vector of bits in big endian format
and transforms it into a vector of little endian u64 elements.
fn to_bits(&self) -> Vec<bool>ⓘ
[src]
fn find_wnaf(&self) -> Vec<i64>ⓘ
[src]
impl BigInteger for BigInteger128
[src]
fn add_nocarry(&mut self, other: &Self) -> bool
[src]
fn sub_noborrow(&mut self, other: &Self) -> bool
[src]
fn mul2(&mut self)
[src]
fn muln(&mut self, n: u32)
[src]
fn div2(&mut self)
[src]
fn divn(&mut self, n: u32)
[src]
fn is_odd(&self) -> bool
[src]
fn is_even(&self) -> bool
[src]
fn is_zero(&self) -> bool
[src]
fn num_bits(&self) -> u32
[src]
fn get_bit(&self, i: usize) -> bool
[src]
fn from_bits(bits: &[bool]) -> Self
[src]
Constructs a BigInteger
by parsing a vector of bits in big endian format
and transforms it into a vector of little endian u64 elements.
fn to_bits(&self) -> Vec<bool>ⓘ
[src]
fn find_wnaf(&self) -> Vec<i64>ⓘ
[src]
impl BigInteger for BigInteger256
[src]
fn add_nocarry(&mut self, other: &Self) -> bool
[src]
fn sub_noborrow(&mut self, other: &Self) -> bool
[src]
fn mul2(&mut self)
[src]
fn muln(&mut self, n: u32)
[src]
fn div2(&mut self)
[src]
fn divn(&mut self, n: u32)
[src]
fn is_odd(&self) -> bool
[src]
fn is_even(&self) -> bool
[src]
fn is_zero(&self) -> bool
[src]
fn num_bits(&self) -> u32
[src]
fn get_bit(&self, i: usize) -> bool
[src]
fn from_bits(bits: &[bool]) -> Self
[src]
Constructs a BigInteger
by parsing a vector of bits in big endian format
and transforms it into a vector of little endian u64 elements.
fn to_bits(&self) -> Vec<bool>ⓘ
[src]
fn find_wnaf(&self) -> Vec<i64>ⓘ
[src]
impl BigInteger for BigInteger320
[src]
fn add_nocarry(&mut self, other: &Self) -> bool
[src]
fn sub_noborrow(&mut self, other: &Self) -> bool
[src]
fn mul2(&mut self)
[src]
fn muln(&mut self, n: u32)
[src]
fn div2(&mut self)
[src]
fn divn(&mut self, n: u32)
[src]
fn is_odd(&self) -> bool
[src]
fn is_even(&self) -> bool
[src]
fn is_zero(&self) -> bool
[src]
fn num_bits(&self) -> u32
[src]
fn get_bit(&self, i: usize) -> bool
[src]
fn from_bits(bits: &[bool]) -> Self
[src]
Constructs a BigInteger
by parsing a vector of bits in big endian format
and transforms it into a vector of little endian u64 elements.
fn to_bits(&self) -> Vec<bool>ⓘ
[src]
fn find_wnaf(&self) -> Vec<i64>ⓘ
[src]
impl BigInteger for BigInteger384
[src]
fn add_nocarry(&mut self, other: &Self) -> bool
[src]
fn sub_noborrow(&mut self, other: &Self) -> bool
[src]
fn mul2(&mut self)
[src]
fn muln(&mut self, n: u32)
[src]
fn div2(&mut self)
[src]
fn divn(&mut self, n: u32)
[src]
fn is_odd(&self) -> bool
[src]
fn is_even(&self) -> bool
[src]
fn is_zero(&self) -> bool
[src]
fn num_bits(&self) -> u32
[src]
fn get_bit(&self, i: usize) -> bool
[src]
fn from_bits(bits: &[bool]) -> Self
[src]
Constructs a BigInteger
by parsing a vector of bits in big endian format
and transforms it into a vector of little endian u64 elements.
fn to_bits(&self) -> Vec<bool>ⓘ
[src]
fn find_wnaf(&self) -> Vec<i64>ⓘ
[src]
impl BigInteger for BigInteger768
[src]
fn add_nocarry(&mut self, other: &Self) -> bool
[src]
fn sub_noborrow(&mut self, other: &Self) -> bool
[src]
fn mul2(&mut self)
[src]
fn muln(&mut self, n: u32)
[src]
fn div2(&mut self)
[src]
fn divn(&mut self, n: u32)
[src]
fn is_odd(&self) -> bool
[src]
fn is_even(&self) -> bool
[src]
fn is_zero(&self) -> bool
[src]
fn num_bits(&self) -> u32
[src]
fn get_bit(&self, i: usize) -> bool
[src]
fn from_bits(bits: &[bool]) -> Self
[src]
Constructs a BigInteger
by parsing a vector of bits in big endian format
and transforms it into a vector of little endian u64 elements.
fn to_bits(&self) -> Vec<bool>ⓘ
[src]
fn find_wnaf(&self) -> Vec<i64>ⓘ
[src]
impl BigInteger for BigInteger832
[src]
fn add_nocarry(&mut self, other: &Self) -> bool
[src]
fn sub_noborrow(&mut self, other: &Self) -> bool
[src]
fn mul2(&mut self)
[src]
fn muln(&mut self, n: u32)
[src]
fn div2(&mut self)
[src]
fn divn(&mut self, n: u32)
[src]
fn is_odd(&self) -> bool
[src]
fn is_even(&self) -> bool
[src]
fn is_zero(&self) -> bool
[src]
fn num_bits(&self) -> u32
[src]
fn get_bit(&self, i: usize) -> bool
[src]
fn from_bits(bits: &[bool]) -> Self
[src]
Constructs a BigInteger
by parsing a vector of bits in big endian format
and transforms it into a vector of little endian u64 elements.