Struct boojum::gadgets::u32::UInt32

source ·
pub struct UInt32<F: SmallField> { /* private fields */ }

Implementations§

source§

impl<F: SmallField> UInt32<F>

source

pub const fn get_variable(&self) -> Variable

source

pub const fn into_num(self) -> Num<F>

source

pub fn allocated_constant<CS: ConstraintSystem<F>>( cs: &mut CS, constant: u32, ) -> Self

source

pub fn zero<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self

source

pub fn allocate_checked<CS: ConstraintSystem<F>>( cs: &mut CS, witness: u32, ) -> Self

source

pub fn from_variable_checked<CS: ConstraintSystem<F>>( cs: &mut CS, variable: Variable, ) -> Self

source

pub const unsafe fn from_variable_unchecked(variable: Variable) -> Self

§Safety

Does not check the variable to be valid.

source

pub fn overflowing_add<CS: ConstraintSystem<F>>( self, cs: &mut CS, other: Self, ) -> (Self, Boolean<F>)

source

pub fn overflowing_add_with_carry_in<CS: ConstraintSystem<F>>( self, cs: &mut CS, other: Self, carry_in: Boolean<F>, ) -> (Self, Boolean<F>)

source

pub fn overflowing_sub<CS: ConstraintSystem<F>>( self, cs: &mut CS, other: Self, ) -> (Self, Boolean<F>)

source

pub fn overflowing_sub_with_borrow_in<CS: ConstraintSystem<F>>( self, cs: &mut CS, other: Self, borrow_in: Boolean<F>, ) -> (Self, Boolean<F>)

source

pub fn decompose_into_bytes<CS: ConstraintSystem<F>>( self, cs: &mut CS, ) -> [UInt8<F>; 4]

source

pub unsafe fn decompose_into_bytes_unchecked<CS: ConstraintSystem<F>>( self, cs: &mut CS, ) -> [UInt8<F>; 4]

§Safety

Assumes that the variable is valid.

source

pub fn from_le_bytes<CS: ConstraintSystem<F>>( cs: &mut CS, bytes: [UInt8<F>; 4], ) -> Self

source

pub fn from_be_bytes<CS: ConstraintSystem<F>>( cs: &mut CS, bytes: [UInt8<F>; 4], ) -> Self

source

pub fn fma_with_carry<CS: ConstraintSystem<F>>( cs: &mut CS, a: Self, b: Self, c: Self, carry_in: Self, ) -> [(Self, [UInt8<F>; 4]); 2]

source

pub fn add_no_overflow<CS: ConstraintSystem<F>>( self, cs: &mut CS, other: Self, ) -> Self

source

pub fn sub_no_overflow<CS: ConstraintSystem<F>>( self, cs: &mut CS, other: Self, ) -> Self

source

pub fn mask<CS: ConstraintSystem<F>>( &self, cs: &mut CS, masking_bit: Boolean<F>, ) -> Self

source

pub fn mask_negated<CS: ConstraintSystem<F>>( &self, cs: &mut CS, masking_bit: Boolean<F>, ) -> Self

source

pub fn equals<CS: ConstraintSystem<F>>( cs: &mut CS, a: &Self, b: &Self, ) -> Boolean<F>

source

pub unsafe fn increment_unchecked<CS: ConstraintSystem<F>>( &self, cs: &mut CS, ) -> Self

§Safety

Does not check if the resulting variable is valid.

source

pub unsafe fn decrement_unchecked<CS: ConstraintSystem<F>>( &self, cs: &mut CS, ) -> Self

§Safety

Does not check if the resulting variable is valid.

source

pub fn increment_checked<CS: ConstraintSystem<F>>( &self, cs: &mut CS, ) -> (Self, Boolean<F>)

source

pub fn low_u16<CS: ConstraintSystem<F>>(&self, cs: &mut CS) -> UInt16<F>

source

pub fn decompose_into_uint16<CS: ConstraintSystem<F>>( &self, _cs: &mut CS, ) -> [UInt16<F>; 2]

source

pub fn is_zero<CS: ConstraintSystem<F>>(&self, cs: &mut CS) -> Boolean<F>

source

pub fn non_widening_mul<CS: ConstraintSystem<F>>( &self, cs: &mut CS, other: &Self, ) -> Self

source

pub fn allocate_from_closure_and_dependencies<CS: ConstraintSystem<F>, FN: FnOnce(&[F]) -> u32 + 'static + Send + Sync>( cs: &mut CS, witness_closure: FN, dependencies: &[Place], ) -> Self

source

pub fn div_by_constant<CS: ConstraintSystem<F>>( &self, cs: &mut CS, constant: u32, ) -> (Self, Self)

source

pub fn to_le_bytes<CS: ConstraintSystem<F>>(self, cs: &mut CS) -> [UInt8<F>; 4]

source

pub fn to_be_bytes<CS: ConstraintSystem<F>>(self, cs: &mut CS) -> [UInt8<F>; 4]

source

pub fn div2<CS: ConstraintSystem<F>>(&self, cs: &mut CS) -> Self

Trait Implementations§

source§

impl<F: SmallField> CSAllocatable<F> for UInt32<F>

§

type Witness = u32

source§

fn placeholder_witness() -> Self::Witness

source§

fn allocate_without_value<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self

source§

fn allocate<CS: ConstraintSystem<F>>( cs: &mut CS, witness: Self::Witness, ) -> Self

source§

fn allocate_constant<CS: ConstraintSystem<F>>( cs: &mut CS, witness: Self::Witness, ) -> Self

source§

impl<F: SmallField> CSAllocatableExt<F> for UInt32<F>

source§

const INTERNAL_STRUCT_LEN: usize = 1usize

source§

fn witness_from_set_of_values(values: [F; 1]) -> Self::Witness

source§

fn create_without_value<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self

source§

fn flatten_as_variables(&self) -> [Variable; 1]
where [(); 1]:,

source§

fn set_internal_variables_values( witness: Self::Witness, dst: &mut DstBuffer<'_, '_, F>, )

NOTE: implementations SHOULD EXTEND/PUSH to buffer, so recursive composition is available
source§

impl<F: SmallField> CSPlaceholder<F> for UInt32<F>

source§

impl<F: SmallField> CSWitnessable<F, 1> for UInt32<F>

source§

impl<F: SmallField> CircuitVarLengthEncodable<F> for UInt32<F>

source§

impl<F: SmallField> Clone for UInt32<F>

source§

fn clone(&self) -> Self

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<F: SmallField> Debug for UInt32<F>

source§

fn fmt(&self, __f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<F: SmallField> Hash for UInt32<F>

source§

fn hash<__HF>(&self, __state: &mut __HF)
where __HF: Hasher,

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<F: SmallField> PartialEq for UInt32<F>

source§

fn eq(&self, other: &Self) -> 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<F: SmallField> Selectable<F> for UInt32<F>

source§

fn conditionally_select<CS: ConstraintSystem<F>>( cs: &mut CS, flag: Boolean<F>, a: &Self, b: &Self, ) -> Self

Selects a if flag is true, and b otherwise
source§

const SUPPORTS_PARALLEL_SELECT: bool = true

source§

fn parallel_select<CS: ConstraintSystem<F>, const N: usize>( cs: &mut CS, flag: Boolean<F>, a: &[Self; N], b: &[Self; N], ) -> [Self; N]

Selects a if flag is true, and b otherwise
source§

fn select_from_chain<CS: ConstraintSystem<F>>( cs: &mut CS, baseline: &Self, candidates: impl Iterator<Item = (Boolean<F>, Self)>, length: usize, ) -> Self

source§

impl<F: SmallField> WitnessHookable<F> for UInt32<F>

source§

fn witness_hook<CS: ConstraintSystem<F>>( &self, cs: &CS, ) -> Box<dyn FnOnce() -> Option<Self::Witness>>

source§

impl<F: SmallField> WitnessVarLengthEncodable<F> for UInt32<F>

source§

fn witness_encoding_length(_witness: &Self::Witness) -> usize

source§

fn encode_witness_to_buffer(witness: &Self::Witness, dst: &mut Vec<F>)

source§

impl<F: SmallField> Copy for UInt32<F>

source§

impl<F: SmallField> Eq for UInt32<F>

Auto Trait Implementations§

§

impl<F> Freeze for UInt32<F>

§

impl<F> RefUnwindSafe for UInt32<F>
where F: RefUnwindSafe,

§

impl<F> Send for UInt32<F>

§

impl<F> Sync for UInt32<F>

§

impl<F> Unpin for UInt32<F>
where F: Unpin,

§

impl<F> UnwindSafe for UInt32<F>
where F: UnwindSafe,

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

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

source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

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

source§

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

🔬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
source§

impl<T> PipeOp<T> for T

source§

fn to<F, U>(self, f: F) -> U
where F: FnOnce(T) -> U,

source§

fn op<F>(self, f: F) -> T
where F: FnOnce(&mut T),

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

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

Initializes a with the given initializer. Read more
source§

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

Dereferences the given pointer. Read more
source§

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

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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

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

source§

fn vzip(self) -> V