pub struct BarrelShifter {
pub output: Col<B1, 32>,
pub variant: ShiftVariant,
/* private fields */
}
Expand description
A gadget for performing a barrel shift circuit (https://en.wikipedia.org/wiki/Barrel_shifter).
The BarrelShifter
gadget allows for left shifts, right shifts, and
rotations on 32-bit inputs, with a configurable shift amount and direction.
Fields§
§output: Col<B1, 32>
The output column representing the result of the shift operation. This column is virtual or committed, depending on the flags
variant: ShiftVariant
The variant of the shift operation: logical left, logical right or circular left.
Implementations§
Source§impl BarrelShifter
impl BarrelShifter
Sourcepub fn new(
table: &mut TableBuilder<'_>,
input: Col<B1, 32>,
shift_amount: Col<B1, 16>,
variant: ShiftVariant,
) -> Self
pub fn new( table: &mut TableBuilder<'_>, input: Col<B1, 32>, shift_amount: Col<B1, 16>, variant: ShiftVariant, ) -> Self
Creates a new instance of the BarrelShifter
gadget.
§Arguments
table
- A mutable reference to theTableBuilder
used to define the gadget.input
- The input column of typeCol<B1, 32>
.shift_amount
- The shift amount column of typeCol<B1, 16>
. The 11 most significant bits are ignored.variant
- Indicates whether the circuits performs a logical left, logical right, or circular left shift.
§Returns
A new instance of the BarrelShifter
gadget.
Auto Trait Implementations§
impl Freeze for BarrelShifter
impl RefUnwindSafe for BarrelShifter
impl Send for BarrelShifter
impl Sync for BarrelShifter
impl Unpin for BarrelShifter
impl UnwindSafe for BarrelShifter
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