Arithmetic
Arithmetic mnemonics take register operands. See CandleVM arithmetic opcodes for numeric type rules and runtime errors.
| CASM mnemonic | CandleVM opcode | Operands | Behavior |
|---|---|---|---|
add | Add | destination, left, right | Adds the values in left and right and writes the result to destination. |
sub | Sub | destination, left, right | Subtracts right from left and writes the result to destination. |
mul | Mul | destination, left, right | Multiplies the values in left and right and writes the result to destination. |
div | Div | destination, left, right | Divides left by right and writes the result to destination. |
mod | Mod | destination, left, right | Writes the remainder of left divided by right to destination. |
inc | Inc | value | Adds one to the value in the register in place. |
dec | Dec | value | Subtracts one from the value in the register in place. |
CandleC validates operand count and register syntax, but does not statically check that the values are numeric.