[−][src]Trait snarkvm_models::gadgets::utilities::uint::unsigned_integer::UInt
Required methods
pub fn negate(&self) -> Self[src]
Returns the inverse UInt
pub fn is_constant(&self) -> bool[src]
Returns true if all bits in this UInt are constant
pub fn to_bits_le(&self) -> Vec<Boolean>[src]
Turns this UInt into its little-endian byte order representation.
LSB-first means that we can easily get the corresponding field element
via double and add.
pub fn from_bits_le(bits: &[Boolean]) -> Self[src]
Converts a little-endian byte order representation of bits into a
UInt.
pub fn rotr(&self, by: usize) -> Self[src]
Rotate self bits by size
pub fn xor<F: Field, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
XOR this UInt with another UInt
pub fn addmany<F: PrimeField, CS: ConstraintSystem<F>>(
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>[src]
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>
Perform modular addition of several UInt objects.
pub fn sub<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Perform modular subtraction of two UInt objects.
pub fn sub_unsafe<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Perform unsafe subtraction of two UInt objects which returns 0 if overflowed
pub fn mul<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Perform Bitwise multiplication of two UInt objects.
Reference: https://en.wikipedia.org/wiki/Binary_multiplier
pub fn div<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Perform long division of two UInt objects.
Reference: https://en.wikipedia.org/wiki/Division_algorithm
pub fn pow<F: Field + PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Bitwise exponentiation of two UInt64 objects.
Reference: /snarkVM/models/src/curves/field.rs
Provided methods
pub fn result_is_constant(first: &Self, second: &Self) -> bool[src]
Returns true if both UInt objects have constant bits
Implementors
impl UInt for UInt128[src]
pub fn negate(&self) -> Self[src]
Returns the inverse UInt128
pub fn is_constant(&self) -> bool[src]
Returns true if all bits in this UInt128 are constant
pub fn to_bits_le(&self) -> Vec<Boolean>[src]
Turns this UInt128 into its little-endian byte order representation.
pub fn from_bits_le(bits: &[Boolean]) -> Self[src]
Converts a little-endian byte order representation of bits into a
UInt128.
pub fn rotr(&self, by: usize) -> Self[src]
pub fn xor<F: Field, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
XOR this UInt128 with another UInt128
pub fn addmany<F: PrimeField, CS: ConstraintSystem<F>>(
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>[src]
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>
Perform modular addition of several UInt128 objects.
pub fn sub<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Perform modular subtraction of two UInt128 objects.
pub fn sub_unsafe<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Perform unsafe subtraction of two UInt128 objects which returns 0 if overflowed
pub fn mul<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Bitwise multiplication of two UInt128 objects.
Reference: https://en.wikipedia.org/wiki/Binary_multiplier
pub fn div<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Perform long division of two UInt128 objects.
Reference: https://en.wikipedia.org/wiki/Division_algorithm
pub fn pow<F: Field + PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Bitwise multiplication of two UInt128 objects.
Reference: /snarkVM/models/src/curves/field.rs
impl UInt for UInt8[src]
pub fn negate(&self) -> Self[src]
pub fn is_constant(&self) -> bool[src]
pub fn to_bits_le(&self) -> Vec<Boolean>[src]
pub fn from_bits_le(bits: &[Boolean]) -> Self[src]
pub fn rotr(&self, by: usize) -> Self[src]
pub fn xor<F: Field, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn addmany<F: PrimeField, CS: ConstraintSystem<F>>(
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>[src]
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>
pub fn sub<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn sub_unsafe<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Used for division. Evaluates a - b, and when a - b < 0, returns 0.
pub fn mul<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn div<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn pow<F: Field + PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
impl UInt for UInt16[src]
pub fn negate(&self) -> Self[src]
pub fn is_constant(&self) -> bool[src]
pub fn to_bits_le(&self) -> Vec<Boolean>[src]
pub fn from_bits_le(bits: &[Boolean]) -> Self[src]
pub fn rotr(&self, by: usize) -> Self[src]
pub fn xor<F: Field, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn addmany<F: PrimeField, CS: ConstraintSystem<F>>(
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>[src]
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>
pub fn sub<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn sub_unsafe<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Used for division. Evaluates a - b, and when a - b < 0, returns 0.
pub fn mul<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn div<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn pow<F: Field + PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
impl UInt for UInt32[src]
pub fn negate(&self) -> Self[src]
pub fn is_constant(&self) -> bool[src]
pub fn to_bits_le(&self) -> Vec<Boolean>[src]
pub fn from_bits_le(bits: &[Boolean]) -> Self[src]
pub fn rotr(&self, by: usize) -> Self[src]
pub fn xor<F: Field, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn addmany<F: PrimeField, CS: ConstraintSystem<F>>(
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>[src]
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>
pub fn sub<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn sub_unsafe<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Used for division. Evaluates a - b, and when a - b < 0, returns 0.
pub fn mul<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn div<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn pow<F: Field + PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
impl UInt for UInt64[src]
pub fn negate(&self) -> Self[src]
pub fn is_constant(&self) -> bool[src]
pub fn to_bits_le(&self) -> Vec<Boolean>[src]
pub fn from_bits_le(bits: &[Boolean]) -> Self[src]
pub fn rotr(&self, by: usize) -> Self[src]
pub fn xor<F: Field, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn addmany<F: PrimeField, CS: ConstraintSystem<F>>(
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>[src]
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>
pub fn sub<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn sub_unsafe<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Used for division. Evaluates a - b, and when a - b < 0, returns 0.
pub fn mul<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn div<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
pub fn pow<F: Field + PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>[src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>