pub struct BigInt<const N: usize>(pub [u64; N]);
Tuple Fields§
§0: [u64; N]
Implementations§
Trait Implementations§
Source§impl<const N: usize> BigInteger for BigInt<N>
impl<const N: usize> BigInteger for BigInt<N>
Source§fn add_with_carry(&mut self, other: &Self) -> bool
fn add_with_carry(&mut self, other: &Self) -> bool
Add another
BigInteger
to self
. This method stores the result in self
,
and returns a carry bit. Read moreSource§fn sub_with_borrow(&mut self, other: &Self) -> bool
fn sub_with_borrow(&mut self, other: &Self) -> bool
Subtract another
BigInteger
from this one. This method stores the result in
self
, and returns a borrow. Read moreSource§fn mul2(&mut self) -> bool
fn mul2(&mut self) -> bool
Performs a leftwise bitshift of this number, effectively multiplying
it by 2. Overflow is ignored. Read more
Source§fn muln(&mut self, n: u32)
fn muln(&mut self, n: u32)
Performs a leftwise bitshift of this number by n bits, effectively multiplying
it by 2^n. Overflow is ignored. Read more
Source§fn div2(&mut self)
fn div2(&mut self)
Performs a rightwise bitshift of this number, effectively dividing
it by 2. Read more
Source§fn divn(&mut self, n: u32)
fn divn(&mut self, n: u32)
Performs a rightwise bitshift of this number by some amount. Read more
Source§fn num_bits(&self) -> u32
fn num_bits(&self) -> u32
Compute the minimum number of bits needed to encode this number. Read more
Source§fn from_bits_be(bits: &[bool]) -> Self
fn from_bits_be(bits: &[bool]) -> Self
Returns the big integer representation of a given big endian boolean
array. Read more
Source§fn from_bits_le(bits: &[bool]) -> Self
fn from_bits_le(bits: &[bool]) -> Self
Returns the big integer representation of a given little endian boolean
array. Read more
Source§fn to_bytes_be(&self) -> Vec<u8>
fn to_bytes_be(&self) -> Vec<u8>
Returns the byte representation in a big endian byte array,
with leading zeros. Read more
Source§fn to_bytes_le(&self) -> Vec<u8>
fn to_bytes_le(&self) -> Vec<u8>
Returns the byte representation in a little endian byte array,
with trailing zeros. Read more
Source§fn to_bits_be(&self) -> Vec<bool>
fn to_bits_be(&self) -> Vec<bool>
Returns the bit representation in a big endian boolean array,
with leading zeroes. Read more
Source§impl<const N: usize> CanonicalDeserialize for BigInt<N>
impl<const N: usize> CanonicalDeserialize for BigInt<N>
Source§fn deserialize_with_mode<R: Read>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Self, SerializationError>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
The general deserialize method that takes in customization flags.
fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_compressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
Source§impl<const N: usize> CanonicalSerialize for BigInt<N>
impl<const N: usize> CanonicalSerialize for BigInt<N>
Source§fn serialize_with_mode<W: Write>(
&self,
writer: W,
compress: Compress,
) -> Result<(), SerializationError>
fn serialize_with_mode<W: Write>( &self, writer: W, compress: Compress, ) -> Result<(), SerializationError>
The general serialize method that takes in customization flags.
fn serialized_size(&self, compress: Compress) -> usize
fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn compressed_size(&self) -> usize
fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn uncompressed_size(&self) -> usize
Source§impl<const N: usize> Distribution<BigInt<N>> for Standard
impl<const N: usize> Distribution<BigInt<N>> for Standard
Source§impl<const N: usize> Ord for BigInt<N>
impl<const N: usize> Ord for BigInt<N>
Source§impl<const N: usize> PartialOrd for BigInt<N>
impl<const N: usize> PartialOrd for BigInt<N>
impl<const N: usize> Copy for BigInt<N>
impl<const N: usize> Eq for BigInt<N>
impl<const N: usize> StructuralPartialEq for BigInt<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for BigInt<N>
impl<const N: usize> RefUnwindSafe for BigInt<N>
impl<const N: usize> Send for BigInt<N>
impl<const N: usize> Sync for BigInt<N>
impl<const N: usize> Unpin for BigInt<N>
impl<const N: usize> UnwindSafe for BigInt<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CanonicalSerializeHashExt for Twhere
T: CanonicalSerialize,
impl<T> CanonicalSerializeHashExt for Twhere
T: CanonicalSerialize,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more