ark_ff::biginteger

Struct BigInt

Source
pub struct BigInt<const N: usize>(pub [u64; N]);

Tuple Fields§

§0: [u64; N]

Implementations§

Source§

impl<const N: usize> BigInt<N>

Source

pub const fn new(value: [u64; N]) -> Self

Source

pub const fn zero() -> Self

Source

pub const fn one() -> Self

Trait Implementations§

Source§

impl<const N: usize> AsMut<[u64]> for BigInt<N>

Source§

fn as_mut(&mut self) -> &mut [u64]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<const N: usize> AsRef<[u64]> for BigInt<N>

Source§

fn as_ref(&self) -> &[u64]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<const N: usize> BigInteger for BigInt<N>

Source§

const NUM_LIMBS: usize = N

Number of 64-bit limbs representing Self.
Source§

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 more
Source§

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 more
Source§

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)

👎Deprecated since 0.4.2: please use the operator << instead
Performs a leftwise bitshift of this number by n bits, effectively multiplying it by 2^n. Overflow is ignored. Read more
Source§

fn mul(&self, other: &Self) -> (Self, Self)

Multiplies this BigInteger by another BigInteger, returning both low and high bits of the result. Read more
Source§

fn mul_low(&self, other: &Self) -> Self

Multiplies this BigInteger by another BigInteger, storing the result in self. Overflow is ignored. Read more
Source§

fn mul_high(&self, other: &Self) -> Self

Multiplies this BigInteger by another BigInteger, returning the high bits of the result. Read more
Source§

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)

👎Deprecated since 0.4.2: please use the operator >> instead
Performs a rightwise bitshift of this number by some amount. Read more
Source§

fn is_odd(&self) -> bool

Returns true iff this number is odd. Read more
Source§

fn is_even(&self) -> bool

Returns true iff this number is even. Read more
Source§

fn is_zero(&self) -> bool

Returns true iff this number is zero. Read more
Source§

fn num_bits(&self) -> u32

Compute the minimum number of bits needed to encode this number. Read more
Source§

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

Compute the i-th bit of self. Read more
Source§

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

Returns the big integer representation of a given little endian boolean array. Read more
Source§

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>

Returns the byte representation in a little endian byte array, with trailing zeros. Read more
Source§

fn to_bits_be(&self) -> Vec<bool>

Returns the bit representation in a big endian boolean array, with leading zeroes. Read more
Source§

fn to_bits_le(&self) -> Vec<bool>

Returns the bit representation in a little endian boolean array, with trailing zeroes. Read more
Source§

fn find_wnaf(&self, w: usize) -> Option<Vec<i64>>

Returns the windowed non-adjacent form of self, for a window of size w.
Source§

impl<B: Borrow<Self>, const N: usize> BitAnd<B> for BigInt<N>

Source§

type Output = BigInt<N>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: B) -> Self::Output

Performs the & operation. Read more
Source§

impl<B: Borrow<Self>, const N: usize> BitAndAssign<B> for BigInt<N>

Source§

fn bitand_assign(&mut self, rhs: B)

Performs the &= operation. Read more
Source§

impl<B: Borrow<Self>, const N: usize> BitOr<B> for BigInt<N>

Source§

type Output = BigInt<N>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: B) -> Self::Output

Performs the | operation. Read more
Source§

impl<B: Borrow<Self>, const N: usize> BitOrAssign<B> for BigInt<N>

Source§

fn bitor_assign(&mut self, rhs: B)

Performs the |= operation. Read more
Source§

impl<B: Borrow<Self>, const N: usize> BitXor<B> for BigInt<N>

Source§

type Output = BigInt<N>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: B) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<B: Borrow<Self>, const N: usize> BitXorAssign<B> for BigInt<N>

Source§

fn bitxor_assign(&mut self, rhs: B)

Performs the ^= operation. Read more
Source§

impl<const N: usize> CanonicalDeserialize for BigInt<N>

Source§

fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>

The general deserialize method that takes in customization flags.
Source§

fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>
where R: Read,

Source§

fn deserialize_compressed_unchecked<R>( reader: R, ) -> Result<Self, SerializationError>
where R: Read,

Source§

fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>
where R: Read,

Source§

fn deserialize_uncompressed_unchecked<R>( reader: R, ) -> Result<Self, SerializationError>
where R: Read,

Source§

impl<const N: usize> CanonicalSerialize for BigInt<N>

Source§

fn serialize_with_mode<W: Write>( &self, writer: W, compress: Compress, ) -> Result<(), SerializationError>

The general serialize method that takes in customization flags.
Source§

fn serialized_size(&self, compress: Compress) -> usize

Source§

fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>
where W: Write,

Source§

fn compressed_size(&self) -> usize

Source§

fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>
where W: Write,

Source§

fn uncompressed_size(&self) -> usize

Source§

impl<const N: usize> Clone for BigInt<N>

Source§

fn clone(&self) -> BigInt<N>

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<const N: usize> Debug for BigInt<N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> Default for BigInt<N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const N: usize> Display for BigInt<N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> Distribution<BigInt<N>> for Standard

Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> BigInt<N>

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
Source§

impl<const N: usize> From<BigInt<N>> for BigInt

Source§

fn from(val: BigInt<N>) -> BigInt

Converts to this type from the input type.
Source§

impl<const N: usize> From<BigInt<N>> for BigUint

Source§

fn from(val: BigInt<N>) -> BigUint

Converts to this type from the input type.
Source§

impl<P: FpConfig<N>, const N: usize> From<BigInt<N>> for Fp<P, N>

Source§

fn from(int: BigInt<N>) -> Self

Converts Self::BigInteger into Self

Source§

impl<P: FpConfig<N>, const N: usize> From<Fp<P, N>> for BigInt<N>

Source§

fn from(fp: Fp<P, N>) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<u16> for BigInt<N>

Source§

fn from(val: u16) -> BigInt<N>

Converts to this type from the input type.
Source§

impl<const N: usize> From<u32> for BigInt<N>

Source§

fn from(val: u32) -> BigInt<N>

Converts to this type from the input type.
Source§

impl<const N: usize> From<u64> for BigInt<N>

Source§

fn from(val: u64) -> BigInt<N>

Converts to this type from the input type.
Source§

impl<const N: usize> From<u8> for BigInt<N>

Source§

fn from(val: u8) -> BigInt<N>

Converts to this type from the input type.
Source§

impl<const N: usize> FromStr for BigInt<N>

Source§

type Err = ()

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<const N: usize> Hash for BigInt<N>

Source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

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

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<const N: usize> Not for BigInt<N>

Source§

type Output = BigInt<N>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<const N: usize> Ord for BigInt<N>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<const N: usize> PartialEq for BigInt<N>

Source§

fn eq(&self, other: &BigInt<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialOrd for BigInt<N>

Source§

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

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

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<const N: usize> Shl<u32> for BigInt<N>

Source§

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§

type Output = BigInt<N>

The resulting type after applying the << operator.
Source§

impl<const N: usize> ShlAssign<u32> for BigInt<N>

Source§

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>

Source§

fn shr(self, rhs: u32) -> Self::Output

Computes bitwise shift right operation.

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§

type Output = BigInt<N>

The resulting type after applying the >> operator.
Source§

impl<const N: usize> ShrAssign<u32> for BigInt<N>

Source§

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> TryFrom<BigUint> for BigInt<N>

Source§

fn try_from(val: BigUint) -> Result<BigInt<N>, Self::Error>

Returns Err(()) if the bit size of val is more than N * 64.

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

impl<const N: usize> UpperHex for BigInt<N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> Valid for BigInt<N>

Source§

fn check(&self) -> Result<(), SerializationError>

Source§

fn batch_check<'a>( batch: impl Iterator<Item = &'a Self> + Send, ) -> Result<(), SerializationError>
where Self: 'a,

Source§

impl<const N: usize> Zeroize for BigInt<N>

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
Source§

impl<const N: usize> Copy for BigInt<N>

Source§

impl<const N: usize> Eq for BigInt<N>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CanonicalSerializeHashExt for T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UniformRand for T

Source§

fn rand<R>(rng: &mut R) -> T
where R: Rng + ?Sized,

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V