Enum essential_constraint_asm::Stack
source · pub enum Stack {
Push(Word),
Pop,
Dup,
DupFrom,
Swap,
SwapIndex,
Select,
SelectRange,
Repeat,
RepeatEnd,
}
Expand description
Operations related to stack manipulation.
Variants§
Push(Word)
0x01
Push one word onto the stack.
§Bytecode Argument
This operation expects a 8-byte (1-word) argument following its opcode within bytecode.
§Stack Output
[value]
Pop
Dup
DupFrom
0x04
Duplicate the word at the given stack depth index.
0
is the index of the element at the top of the stack.
§Stack Input
[index]
§Stack Output
[value_i]
Swap
SwapIndex
0x06
Swap the top word on the stack with the word at the given stack depth index.
0
is the index of the element at the top of the stack.
§Stack Input
[a, b, c, d, index]
§Stack Output
[a, d, c, b]
§Panics
- Index is out of range.
Select
0x07
Conditionally keep one of the top two elements on the stack.
If condition is true
, the top element is kept.
§Stack Input
[a, b, cond]
§Stack Output
[b]
SelectRange
0x08
Conditionally keep one of the top two ranges on the stack.
If condition is true
, the top range is kept.
The ranges must be of equal length.
The ranges must be stacked sequentially.
Here N
is len -1
.
§Stack Input
[arr_a_0, ..arr_a_N, arr_b_0, ..arr_b_N, len, cond]
§Stack Output
[arr_b_0, ..arr_b_N]
Repeat
0x09
Repeat a section of code the number of times. Takes a boolean to either count from 0 up or from the number of repeats down to 0.
§Stack Input
[num_repeats, count_up_bool]
RepeatEnd
0x0A
Increment or decrements the top counter on the repeat stack.
If the counter is counting up and counter == limit - 1
then this pops the counter and continues with the program.
If the counter is counting down and the counter is 0
then this pops the counter and continues with the program.
If it is < limit - 1
or > 0
respectively then the program jumps to
the last Repeat
§Panics
- If there is no counter on the repeat stack.
- If there is no repeat registered to return to.
Trait Implementations§
source§impl From<Stack> for Constraint
impl From<Stack> for Constraint
source§impl Ord for Stack
impl Ord for Stack
source§impl PartialEq for Stack
impl PartialEq for Stack
source§impl PartialOrd for Stack
impl PartialOrd for Stack
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl TryFromBytes for Stack
impl TryFromBytes for Stack
impl Copy for Stack
impl Eq for Stack
impl StructuralPartialEq for Stack
Auto Trait Implementations§
impl Freeze for Stack
impl RefUnwindSafe for Stack
impl Send for Stack
impl Sync for Stack
impl Unpin for Stack
impl UnwindSafe for Stack
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
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)
clone_to_uninit
)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)
clone_to_uninit
)