Trait snarkvm_wasm::traits::utilities::uint::UInt [−][src]
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, Global>[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, CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field, [src]
CS: ConstraintSystem<F>,
F: Field,
XOR this UInt with another UInt
pub fn addmany<F, CS>(cs: CS, operands: &[Self]) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
CS: ConstraintSystem<F>,
F: PrimeField,
Perform modular addition of several UInt objects.
pub fn sub<F, CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
CS: ConstraintSystem<F>,
F: PrimeField,
Perform modular subtraction of two UInt objects.
pub fn sub_unsafe<F, CS>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
Perform unsafe subtraction of two UInt objects which returns 0 if overflowed
pub fn mul<F, CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
CS: ConstraintSystem<F>,
F: PrimeField,
Perform Bitwise multiplication of two UInt objects.
Reference: https://en.wikipedia.org/wiki/Binary_multiplier
pub fn div<F, CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
CS: ConstraintSystem<F>,
F: PrimeField,
Perform long division of two UInt objects.
Reference: https://en.wikipedia.org/wiki/Division_algorithm
pub fn pow<F, CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field + PrimeField, [src]
CS: ConstraintSystem<F>,
F: Field + PrimeField,
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 UInt8[src]
pub fn negate(&self) -> UInt8[src]
pub fn is_constant(&self) -> bool[src]
pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]
pub fn from_bits_le(bits: &[Boolean]) -> UInt8[src]
pub fn rotr(&self, by: usize) -> UInt8[src]
pub fn xor<F, CS>(&self, cs: CS, other: &UInt8) -> Result<UInt8, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field, [src]
CS: ConstraintSystem<F>,
F: Field,
pub fn addmany<F, CS>(
cs: CS,
operands: &[UInt8]
) -> Result<UInt8, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
cs: CS,
operands: &[UInt8]
) -> Result<UInt8, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn sub<F, CS>(&self, cs: CS, other: &UInt8) -> Result<UInt8, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn sub_unsafe<F, CS>(
&self,
cs: CS,
other: &UInt8
) -> Result<UInt8, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt8
) -> Result<UInt8, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
Used for division. Evaluates a - b, and when a - b < 0, returns 0.
pub fn mul<F, CS>(&self, cs: CS, other: &UInt8) -> Result<UInt8, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn div<F, CS>(&self, cs: CS, other: &UInt8) -> Result<UInt8, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn pow<F, CS>(&self, cs: CS, other: &UInt8) -> Result<UInt8, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field + PrimeField, [src]
CS: ConstraintSystem<F>,
F: Field + PrimeField,
impl UInt for UInt16[src]
pub fn negate(&self) -> UInt16[src]
pub fn is_constant(&self) -> bool[src]
pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]
pub fn from_bits_le(bits: &[Boolean]) -> UInt16[src]
pub fn rotr(&self, by: usize) -> UInt16[src]
pub fn xor<F, CS>(
&self,
cs: CS,
other: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field, [src]
&self,
cs: CS,
other: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field,
pub fn addmany<F, CS>(
cs: CS,
operands: &[UInt16]
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
cs: CS,
operands: &[UInt16]
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn sub<F, CS>(
&self,
cs: CS,
other: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn sub_unsafe<F, CS>(
&self,
cs: CS,
other: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
Used for division. Evaluates a - b, and when a - b < 0, returns 0.
pub fn mul<F, CS>(
&self,
cs: CS,
other: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn div<F, CS>(
&self,
cs: CS,
other: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn pow<F, CS>(
&self,
cs: CS,
other: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field + PrimeField, [src]
&self,
cs: CS,
other: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field + PrimeField,
impl UInt for UInt32[src]
pub fn negate(&self) -> UInt32[src]
pub fn is_constant(&self) -> bool[src]
pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]
pub fn from_bits_le(bits: &[Boolean]) -> UInt32[src]
pub fn rotr(&self, by: usize) -> UInt32[src]
pub fn xor<F, CS>(
&self,
cs: CS,
other: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field, [src]
&self,
cs: CS,
other: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field,
pub fn addmany<F, CS>(
cs: CS,
operands: &[UInt32]
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
cs: CS,
operands: &[UInt32]
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn sub<F, CS>(
&self,
cs: CS,
other: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn sub_unsafe<F, CS>(
&self,
cs: CS,
other: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
Used for division. Evaluates a - b, and when a - b < 0, returns 0.
pub fn mul<F, CS>(
&self,
cs: CS,
other: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn div<F, CS>(
&self,
cs: CS,
other: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn pow<F, CS>(
&self,
cs: CS,
other: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field + PrimeField, [src]
&self,
cs: CS,
other: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field + PrimeField,
impl UInt for UInt64[src]
pub fn negate(&self) -> UInt64[src]
pub fn is_constant(&self) -> bool[src]
pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]
pub fn from_bits_le(bits: &[Boolean]) -> UInt64[src]
pub fn rotr(&self, by: usize) -> UInt64[src]
pub fn xor<F, CS>(
&self,
cs: CS,
other: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field, [src]
&self,
cs: CS,
other: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field,
pub fn addmany<F, CS>(
cs: CS,
operands: &[UInt64]
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
cs: CS,
operands: &[UInt64]
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn sub<F, CS>(
&self,
cs: CS,
other: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn sub_unsafe<F, CS>(
&self,
cs: CS,
other: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
Used for division. Evaluates a - b, and when a - b < 0, returns 0.
pub fn mul<F, CS>(
&self,
cs: CS,
other: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn div<F, CS>(
&self,
cs: CS,
other: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
pub fn pow<F, CS>(
&self,
cs: CS,
other: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field + PrimeField, [src]
&self,
cs: CS,
other: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field + PrimeField,
impl UInt for UInt128[src]
pub fn negate(&self) -> UInt128[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, Global>[src]
Turns this UInt128 into its little-endian byte order representation.
pub fn from_bits_le(bits: &[Boolean]) -> UInt128[src]
Converts a little-endian byte order representation of bits into a
UInt128.
pub fn rotr(&self, by: usize) -> UInt128[src]
pub fn xor<F, CS>(
&self,
cs: CS,
other: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field, [src]
&self,
cs: CS,
other: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field,
XOR this UInt128 with another UInt128
pub fn addmany<F, CS>(
cs: CS,
operands: &[UInt128]
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
cs: CS,
operands: &[UInt128]
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
Perform modular addition of several UInt128 objects.
pub fn sub<F, CS>(
&self,
cs: CS,
other: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
Perform modular subtraction of two UInt128 objects.
pub fn sub_unsafe<F, CS>(
&self,
cs: CS,
other: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
Perform unsafe subtraction of two UInt128 objects which returns 0 if overflowed
pub fn mul<F, CS>(
&self,
cs: CS,
other: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
Bitwise multiplication of two UInt128 objects.
Reference: https://en.wikipedia.org/wiki/Binary_multiplier
pub fn div<F, CS>(
&self,
cs: CS,
other: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField, [src]
&self,
cs: CS,
other: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: PrimeField,
Perform long division of two UInt128 objects.
Reference: https://en.wikipedia.org/wiki/Division_algorithm
pub fn pow<F, CS>(
&self,
cs: CS,
other: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field + PrimeField, [src]
&self,
cs: CS,
other: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
F: Field + PrimeField,
Bitwise multiplication of two UInt128 objects.
Reference: /snarkVM/models/src/curves/field.rs