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
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
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
Source§fn muln(&mut self, n: u32)
fn muln(&mut self, n: u32)
please use the operator << instead
Source§fn mul(&self, other: &Self) -> (Self, Self)
fn mul(&self, other: &Self) -> (Self, Self)
BigInteger by another BigInteger, returning both low and high bits of the result. Read moreSource§fn mul_low(&self, other: &Self) -> Self
fn mul_low(&self, other: &Self) -> Self
BigInteger by another BigInteger, storing the result in self.
Overflow is ignored. Read moreSource§fn div2(&mut self)
fn div2(&mut self)
Source§fn divn(&mut self, n: u32)
fn divn(&mut self, n: u32)
please use the operator >> instead
Source§fn num_bits(&self) -> u32
fn num_bits(&self) -> u32
Source§fn from_bits_be(bits: &[bool]) -> Self
fn from_bits_be(bits: &[bool]) -> Self
Source§fn from_bits_le(bits: &[bool]) -> Self
fn from_bits_le(bits: &[bool]) -> Self
Source§fn to_bytes_be(&self) -> Vec<u8>
fn to_bytes_be(&self) -> Vec<u8>
Source§fn to_bytes_le(&self) -> Vec<u8>
fn to_bytes_le(&self) -> Vec<u8>
Source§fn to_bits_be(&self) -> Vec<bool>
fn to_bits_be(&self) -> Vec<bool>
Source§impl<B: Borrow<Self>, const N: usize> BitAndAssign<B> for BigInt<N>
impl<B: Borrow<Self>, const N: usize> BitAndAssign<B> for BigInt<N>
Source§fn bitand_assign(&mut self, rhs: B)
fn bitand_assign(&mut self, rhs: B)
&= operation. Read moreSource§impl<B: Borrow<Self>, const N: usize> BitOrAssign<B> for BigInt<N>
impl<B: Borrow<Self>, const N: usize> BitOrAssign<B> for BigInt<N>
Source§fn bitor_assign(&mut self, rhs: B)
fn bitor_assign(&mut self, rhs: B)
|= operation. Read moreSource§impl<B: Borrow<Self>, const N: usize> BitXorAssign<B> for BigInt<N>
impl<B: Borrow<Self>, const N: usize> BitXorAssign<B> for BigInt<N>
Source§fn bitxor_assign(&mut self, rhs: B)
fn bitxor_assign(&mut self, rhs: B)
^= operation. Read moreSource§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>
Source§fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
Self from reader using the compressed form if applicable.
Performs validation if applicable.Source§fn deserialize_compressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_compressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
Self from reader using the compressed form if applicable, without validating the
deserialized value. Read moreSource§fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
Self from reader using the uncompressed form. Performs validation if applicable.Source§fn deserialize_uncompressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
Self from reader using the uncompressed form, without validating the deserialized
value. Read moreSource§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>
Source§fn serialized_size(&self, compress: Compress) -> usize
fn serialized_size(&self, compress: Compress) -> usize
self with the given compression mode.Source§fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
self into writer using the compressed form if applicable.Source§fn compressed_size(&self) -> usize
fn compressed_size(&self) -> usize
self.Source§fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
self into writer using the uncompressed form.Source§fn uncompressed_size(&self) -> usize
fn uncompressed_size(&self) -> usize
self.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>
Source§impl<const N: usize> Shl<u32> for BigInt<N>
impl<const N: usize> Shl<u32> for BigInt<N>
Source§fn shl(self, rhs: u32) -> Self::Output
fn shl(self, rhs: u32) -> Self::Output
Computes the bitwise shift left operation in place.
Differently from the built-in numeric types (u8, u32, u64, etc.) this operation does not return an overflow error if the number of bits shifted is larger than N * 64. Instead, the overflow will be chopped off.
Source§impl<const N: usize> ShlAssign<u32> for BigInt<N>
impl<const N: usize> ShlAssign<u32> for BigInt<N>
Source§fn shl_assign(&mut self, rhs: u32)
fn shl_assign(&mut self, rhs: u32)
Computes the bitwise shift left operation in place.
Differently from the built-in numeric types (u8, u32, u64, etc.) this operation does not return an overflow error if the number of bits shifted is larger than N * 64. Instead, the overflow will be chopped off.
Source§impl<const N: usize> Shr<u32> for BigInt<N>
impl<const N: usize> Shr<u32> for BigInt<N>
Source§impl<const N: usize> ShrAssign<u32> for BigInt<N>
impl<const N: usize> ShrAssign<u32> for BigInt<N>
Source§fn shr_assign(&mut self, rhs: u32)
fn shr_assign(&mut self, rhs: u32)
Computes the bitwise shift right operation in place.
Differently from the built-in numeric types (u8, u32, u64, etc.) this operation does not return an underflow error if the number of bits shifted is larger than N * 64. Instead the result will be saturated to zero.
Source§impl<const N: usize> Valid for BigInt<N>
impl<const N: usize> Valid for BigInt<N>
Source§const TRIVIAL_CHECK: bool = true
const TRIVIAL_CHECK: bool = true
check method is trivial (i.e. always returns Ok(())). If this is true,
the batch_check method will skip all checks and return Ok(()).
This should be set to true for types where check is trivial, e.g.
integers, field elements, etc.
This is false by default.
This is primarily an optimization to skip unnecessary checks in batch_check.Source§fn check(&self) -> Result<(), SerializationError>
fn check(&self) -> Result<(), SerializationError>
self is valid. If self is valid, returns Ok(()). Otherwise, returns
an error describing the failure.
This method is called by deserialize_with_mode if validate is Validate::Yes.Source§fn batch_check<'a>(
batch: impl Iterator<Item = &'a Self> + Send,
) -> Result<(), SerializationError>where
Self: 'a,
fn batch_check<'a>(
batch: impl Iterator<Item = &'a Self> + Send,
) -> Result<(), SerializationError>where
Self: 'a,
batch are valid. If all items are valid, returns Ok(()).
Otherwise, returns an error describing the first failure.