pub struct TwosComplement<UPrimitive: UnsignedAddPrimitives, const BIT_LENGTH: usize> {
pub xin: [Col<B1>; BIT_LENGTH],
pub result_bits: [Col<B1>; BIT_LENGTH],
/* private fields */
}
Expand description
Simple gadget that’s used to convert to and from two’s complement binary representations
Fields§
§xin: [Col<B1>; BIT_LENGTH]
§result_bits: [Col<B1>; BIT_LENGTH]
Implementations§
Source§impl<UPrimitive: UnsignedAddPrimitives, const BIT_LENGTH: usize> TwosComplement<UPrimitive, BIT_LENGTH>
impl<UPrimitive: UnsignedAddPrimitives, const BIT_LENGTH: usize> TwosComplement<UPrimitive, BIT_LENGTH>
pub fn new(table: &mut TableBuilder<'_>, xin: [Col<B1>; BIT_LENGTH]) -> Self
pub fn populate<P>( &self, index: &mut TableWitnessSegment<'_, P>, ) -> Result<(), Error>
Trait Implementations§
Auto Trait Implementations§
impl<UPrimitive, const BIT_LENGTH: usize> Freeze for TwosComplement<UPrimitive, BIT_LENGTH>
impl<UPrimitive, const BIT_LENGTH: usize> RefUnwindSafe for TwosComplement<UPrimitive, BIT_LENGTH>where
UPrimitive: RefUnwindSafe,
impl<UPrimitive, const BIT_LENGTH: usize> Send for TwosComplement<UPrimitive, BIT_LENGTH>where
UPrimitive: Send,
impl<UPrimitive, const BIT_LENGTH: usize> Sync for TwosComplement<UPrimitive, BIT_LENGTH>where
UPrimitive: Sync,
impl<UPrimitive, const BIT_LENGTH: usize> Unpin for TwosComplement<UPrimitive, BIT_LENGTH>where
UPrimitive: Unpin,
impl<UPrimitive, const BIT_LENGTH: usize> UnwindSafe for TwosComplement<UPrimitive, BIT_LENGTH>where
UPrimitive: 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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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