pub struct UInt32<F: SmallField> { /* private fields */ }
Implementations§
source§impl<F: SmallField> UInt32<F>
impl<F: SmallField> UInt32<F>
pub const fn get_variable(&self) -> Variable
pub const fn into_num(self) -> Num<F>
pub fn allocated_constant<CS: ConstraintSystem<F>>( cs: &mut CS, constant: u32, ) -> Self
pub fn zero<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self
pub fn allocate_checked<CS: ConstraintSystem<F>>( cs: &mut CS, witness: u32, ) -> Self
pub fn from_variable_checked<CS: ConstraintSystem<F>>( cs: &mut CS, variable: Variable, ) -> Self
sourcepub const unsafe fn from_variable_unchecked(variable: Variable) -> Self
pub const unsafe fn from_variable_unchecked(variable: Variable) -> Self
§Safety
Does not check the variable to be valid.
pub fn overflowing_add<CS: ConstraintSystem<F>>( self, cs: &mut CS, other: Self, ) -> (Self, Boolean<F>)
pub fn overflowing_add_with_carry_in<CS: ConstraintSystem<F>>( self, cs: &mut CS, other: Self, carry_in: Boolean<F>, ) -> (Self, Boolean<F>)
pub fn overflowing_sub<CS: ConstraintSystem<F>>( self, cs: &mut CS, other: Self, ) -> (Self, Boolean<F>)
pub fn overflowing_sub_with_borrow_in<CS: ConstraintSystem<F>>( self, cs: &mut CS, other: Self, borrow_in: Boolean<F>, ) -> (Self, Boolean<F>)
pub fn decompose_into_bytes<CS: ConstraintSystem<F>>( self, cs: &mut CS, ) -> [UInt8<F>; 4]
sourcepub unsafe fn decompose_into_bytes_unchecked<CS: ConstraintSystem<F>>(
self,
cs: &mut CS,
) -> [UInt8<F>; 4]
pub unsafe fn decompose_into_bytes_unchecked<CS: ConstraintSystem<F>>( self, cs: &mut CS, ) -> [UInt8<F>; 4]
§Safety
Assumes that the variable is valid.
pub fn from_le_bytes<CS: ConstraintSystem<F>>( cs: &mut CS, bytes: [UInt8<F>; 4], ) -> Self
pub fn from_be_bytes<CS: ConstraintSystem<F>>( cs: &mut CS, bytes: [UInt8<F>; 4], ) -> Self
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]
pub fn add_no_overflow<CS: ConstraintSystem<F>>( self, cs: &mut CS, other: Self, ) -> Self
pub fn sub_no_overflow<CS: ConstraintSystem<F>>( self, cs: &mut CS, other: Self, ) -> Self
pub fn mask<CS: ConstraintSystem<F>>( &self, cs: &mut CS, masking_bit: Boolean<F>, ) -> Self
pub fn mask_negated<CS: ConstraintSystem<F>>( &self, cs: &mut CS, masking_bit: Boolean<F>, ) -> Self
pub fn equals<CS: ConstraintSystem<F>>( cs: &mut CS, a: &Self, b: &Self, ) -> Boolean<F>
sourcepub unsafe fn increment_unchecked<CS: ConstraintSystem<F>>(
&self,
cs: &mut CS,
) -> Self
pub unsafe fn increment_unchecked<CS: ConstraintSystem<F>>( &self, cs: &mut CS, ) -> Self
§Safety
Does not check if the resulting variable is valid.
sourcepub unsafe fn decrement_unchecked<CS: ConstraintSystem<F>>(
&self,
cs: &mut CS,
) -> Self
pub unsafe fn decrement_unchecked<CS: ConstraintSystem<F>>( &self, cs: &mut CS, ) -> Self
§Safety
Does not check if the resulting variable is valid.
pub fn increment_checked<CS: ConstraintSystem<F>>( &self, cs: &mut CS, ) -> (Self, Boolean<F>)
pub fn low_u16<CS: ConstraintSystem<F>>(&self, cs: &mut CS) -> UInt16<F>
pub fn decompose_into_uint16<CS: ConstraintSystem<F>>( &self, _cs: &mut CS, ) -> [UInt16<F>; 2]
pub fn is_zero<CS: ConstraintSystem<F>>(&self, cs: &mut CS) -> Boolean<F>
pub fn non_widening_mul<CS: ConstraintSystem<F>>( &self, cs: &mut CS, other: &Self, ) -> Self
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
pub fn div_by_constant<CS: ConstraintSystem<F>>( &self, cs: &mut CS, constant: u32, ) -> (Self, Self)
pub fn to_le_bytes<CS: ConstraintSystem<F>>(self, cs: &mut CS) -> [UInt8<F>; 4]
pub fn to_be_bytes<CS: ConstraintSystem<F>>(self, cs: &mut CS) -> [UInt8<F>; 4]
pub fn div2<CS: ConstraintSystem<F>>(&self, cs: &mut CS) -> Self
Trait Implementations§
source§impl<F: SmallField> CSAllocatable<F> for UInt32<F>
impl<F: SmallField> CSAllocatable<F> for UInt32<F>
type Witness = u32
fn placeholder_witness() -> Self::Witness
fn allocate_without_value<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self
fn allocate<CS: ConstraintSystem<F>>( cs: &mut CS, witness: Self::Witness, ) -> Self
fn allocate_constant<CS: ConstraintSystem<F>>( cs: &mut CS, witness: Self::Witness, ) -> Self
source§impl<F: SmallField> CSAllocatableExt<F> for UInt32<F>
impl<F: SmallField> CSAllocatableExt<F> for UInt32<F>
const INTERNAL_STRUCT_LEN: usize = 1usize
fn witness_from_set_of_values(values: [F; 1]) -> Self::Witness
fn create_without_value<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self
fn flatten_as_variables(&self) -> [Variable; 1]
source§fn set_internal_variables_values(
witness: Self::Witness,
dst: &mut DstBuffer<'_, '_, F>,
)
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>
impl<F: SmallField> CSPlaceholder<F> for UInt32<F>
fn placeholder<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self
source§impl<F: SmallField> CSWitnessable<F, 1> for UInt32<F>
impl<F: SmallField> CSWitnessable<F, 1> for UInt32<F>
type ConversionFunction = Convertor<F, [F; 1], u32>
fn witness_from_set_of_values(values: [F; 1]) -> Self::Witness
fn as_variables_set(&self) -> [Variable; 1]
fn get_witness<CS: ConstraintSystem<F>>( &self, cs: &CS, ) -> WitnessValue<F, Self::Witness, N, CS::WitnessSource, Self::ConversionFunction>
source§impl<F: SmallField> CircuitVarLengthEncodable<F> for UInt32<F>
impl<F: SmallField> CircuitVarLengthEncodable<F> for UInt32<F>
fn encoding_length(&self) -> usize
fn encode_to_buffer<CS: ConstraintSystem<F>>( &self, _cs: &mut CS, dst: &mut Vec<Variable>, )
source§impl<F: SmallField> Clone for UInt32<F>
impl<F: SmallField> Clone for UInt32<F>
source§impl<F: SmallField> Debug for UInt32<F>
impl<F: SmallField> Debug for UInt32<F>
source§impl<F: SmallField> Hash for UInt32<F>
impl<F: SmallField> Hash for UInt32<F>
source§impl<F: SmallField> PartialEq for UInt32<F>
impl<F: SmallField> PartialEq for UInt32<F>
source§impl<F: SmallField> Selectable<F> for UInt32<F>
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
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
otherwiseconst 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]
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
otherwisefn 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>
impl<F: SmallField> WitnessHookable<F> for UInt32<F>
fn witness_hook<CS: ConstraintSystem<F>>( &self, cs: &CS, ) -> Box<dyn FnOnce() -> Option<Self::Witness>>
source§impl<F: SmallField> WitnessVarLengthEncodable<F> for UInt32<F>
impl<F: SmallField> WitnessVarLengthEncodable<F> for UInt32<F>
fn witness_encoding_length(_witness: &Self::Witness) -> usize
fn encode_witness_to_buffer(witness: &Self::Witness, dst: &mut Vec<F>)
impl<F: SmallField> Copy for UInt32<F>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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