[−][src]Struct r1cs::BinaryExpression
A BinaryExpression
is comprised of several bits, each one being a BooleanExpression
.
The sequence of bits is often interpreted as an unsigned integer for the purpose of binary arithmetic. When doing so, our convention is to treat the left-most bit as the least significant, and the right-most bit as the most significant.
Fields
bits: Vec<BooleanExpression<F>>
The sequence of bits, ordered from least significant to most significant.
Methods
impl<F: Field> BinaryExpression<F>
[src]
pub fn len(&self) -> usize
[src]
The number of bits.
pub fn zero() -> Self
[src]
pub fn truncate(&mut self, l: usize)
[src]
Truncate the bits in this expression, discarding the more significant bits while keeping the less significant bits.
pub fn truncated(&self, l: usize) -> Self
[src]
Return a copy of this expression truncated to l
bits, discarding the more significant bits
while keeping the less significant bits.
pub fn pad(&mut self, l: usize)
[src]
Pad this bit vector, adding 0 bits on the more significant side.
pub fn padded(&self, l: usize) -> Self
[src]
Return a copy this bit vector, with 0 bits added on the more significant side.
pub fn chunks(&self, chunk_bits: usize) -> Vec<BinaryExpression<F>>
[src]
pub fn add_most_significant(&mut self, bit: BooleanExpression<F>)
[src]
pub fn join(&self) -> Expression<F>
[src]
Join these bits into the field element they encode. This method requires that
2^self.len() < |F|
, otherwise the result might not fit in a single field element.
pub fn join_allowing_overflow(&self) -> Expression<F>
[src]
Join these bits into the field element they encode. This method allows binary expressions of any size, so overflow is possible.
pub fn dependencies(&self) -> Vec<Wire>
[src]
pub fn evaluate(&self, values: &WireValues<F>) -> BigUint
[src]
pub fn concat(expressions: &[BinaryExpression<F>]) -> Self
[src]
Trait Implementations
impl<'_, F: Field> From<&'_ BinaryWire> for BinaryExpression<F>
[src]
fn from(wire: &BinaryWire) -> Self
[src]
impl<F: Field> From<BinaryWire> for BinaryExpression<F>
[src]
fn from(wire: BinaryWire) -> Self
[src]
impl<F: Field> From<BigUint> for BinaryExpression<F>
[src]
impl<F: Field> From<usize> for BinaryExpression<F>
[src]
impl<F: Field> From<u128> for BinaryExpression<F>
[src]
impl<F: Field> From<u64> for BinaryExpression<F>
[src]
impl<F: Field> From<u32> for BinaryExpression<F>
[src]
impl<F: Field> From<u16> for BinaryExpression<F>
[src]
impl<F: Field> From<u8> for BinaryExpression<F>
[src]
impl<F: Field> Clone for BinaryExpression<F>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<F: Debug + Field> Debug for BinaryExpression<F>
[src]
Auto Trait Implementations
impl<F> !Send for BinaryExpression<F>
impl<F> !Sync for BinaryExpression<F>
impl<F> Unpin for BinaryExpression<F>
impl<F> UnwindSafe for BinaryExpression<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<F> RefUnwindSafe for BinaryExpression<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,