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)

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)

Performs a rightwise bitshift of this number, effectively dividing it by 2. Read more
Source§

fn divn(&mut self, n: u32)

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<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.
§

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>

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

§

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> 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 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> 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> 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> 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>

§

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
§

impl<T> CanonicalSerializeHashExt for T
where T: CanonicalSerialize,

§

fn hash<H>(&self) -> GenericArray<u8, <H as OutputSizeUser>::OutputSize>
where H: Digest,

§

fn hash_uncompressed<H>( &self, ) -> GenericArray<u8, <H as OutputSizeUser>::OutputSize>
where H: Digest,

Source§

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

Source§

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

🔬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> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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§

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.
§

impl<T> UniformRand for T

§

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

§

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

§

fn vzip(self) -> V