[][src]Struct snarkos_models::gadgets::utilities::uint::uint128::UInt128

pub struct UInt128 {
    pub bits: Vec<Boolean>,
    pub negated: bool,
    pub value: Option<u128>,
}

Represents an interpretation of 128 Boolean objects as an unsigned integer.

Fields

bits: Vec<Boolean>negated: boolvalue: Option<u128>

Implementations

impl UInt128[src]

pub fn constant(value: u128) -> Self[src]

Construct a constant UInt128 from a u128

Trait Implementations

impl<F: Field + PrimeField> Add<F, UInt128> for UInt128[src]

type ErrorType = SynthesisError

impl<F: Field> AllocGadget<u128, F> for UInt128[src]

impl Clone for UInt128[src]

impl<F: Field + PrimeField> ComparatorGadget<F> for UInt128[src]

impl<F: PrimeField> CondSelectGadget<F> for UInt128[src]

impl<F: Field> ConditionalEqGadget<F> for UInt128[src]

impl Debug for UInt128[src]

impl Eq for UInt128[src]

impl<F: Field> EqGadget<F> for UInt128[src]

impl<F: PrimeField> EvaluateEqGadget<F> for UInt128[src]

impl<F: Field + PrimeField> EvaluateLtGadget<F> for UInt128[src]

impl PartialEq<UInt128> for UInt128[src]

impl PartialOrd<UInt128> for UInt128[src]

impl<F: Field> ToBytesGadget<F> for UInt128[src]

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 xor<F: Field, CS: ConstraintSystem<F>>(
    &self,
    cs: CS,
    other: &Self
) -> Result<Self, SynthesisError>
[src]

XOR this UInt128 with another UInt128

fn addmany<F: PrimeField, CS: ConstraintSystem<F>>(
    cs: CS,
    operands: &[Self]
) -> Result<Self, SynthesisError>
[src]

Perform modular addition of several UInt128 objects.

fn sub<F: PrimeField, CS: ConstraintSystem<F>>(
    &self,
    cs: CS,
    other: &Self
) -> Result<Self, SynthesisError>
[src]

Perform modular subtraction of two UInt128 objects.

fn sub_unsafe<F: PrimeField, CS: ConstraintSystem<F>>(
    &self,
    cs: CS,
    other: &Self
) -> Result<Self, SynthesisError>
[src]

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]

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]

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]

Bitwise multiplication of two UInt128 objects. Reference: /snarkOS/models/src/curves/field.rs

Auto Trait Implementations

impl RefUnwindSafe for UInt128

impl Send for UInt128

impl Sync for UInt128

impl Unpin for UInt128

impl UnwindSafe for UInt128

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<F, T> ConditionalOrEqualsGadget<F> for T where
    F: Field,
    T: ConditionalEqGadget<F> + CondSelectGadget<F>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F, T> OrEqualsGadget<F> for T where
    F: Field,
    T: ConditionalOrEqualsGadget<F>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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