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