pub enum Opcode {
}Expand description
Bytecode instruction set for constraint expression evaluation.
The virtual machine maintains a stack of f32 values.
Each instruction pops its operands and pushes its result.
Variants§
LoadDim(usize)
Push x[dim] onto the stack
LoadConst(f32)
Push a constant onto the stack
Add
Pop b, pop a; push a + b
Sub
Pop b, pop a; push a - b
Mul
Pop b, pop a; push a * b
Div
Pop b, pop a; push a / b (errors on divide-by-zero)
Neg
Pop a; push -a
Abs
Pop a; push |a|
Sqrt
Pop a; push sqrt(a)
Min
Pop b, pop a; push min(a, b)
Max
Pop b, pop a; push max(a, b)
CmpLe
Pop b, pop a; push 1.0 if a <= b, else 0.0
CmpGe
Pop b, pop a; push 1.0 if a >= b, else 0.0
And
Pop b, pop a; push 1.0 if both non-zero, else 0.0
Or
Pop b, pop a; push 1.0 if either non-zero, else 0.0
Not
Pop a; push 1.0 if a == 0.0, else 0.0
Dup
Duplicate the top of the stack
Pop
Discard the top of the stack
Trait Implementations§
impl StructuralPartialEq for Opcode
Auto Trait Implementations§
impl Freeze for Opcode
impl RefUnwindSafe for Opcode
impl Send for Opcode
impl Sync for Opcode
impl Unpin for Opcode
impl UnsafeUnpin for Opcode
impl UnwindSafe for Opcode
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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