neoneo-go/pkg/vm/vm_ops.go

47 lines
1.2 KiB
Go
Raw Normal View History

package vm
import "github.com/CityOfZion/neo-go/pkg/vm/stack"
type stackInfo func(op stack.Instruction, ctx *stack.Context, istack *stack.Invocation, rstack *stack.RandomAccess) (Vmstate, error)
var opFunc = map[stack.Instruction]stackInfo{
stack.TUCK: TUCK,
stack.SWAP: SWAP,
stack.ROT: ROT,
stack.ROLL: ROLL,
stack.NUMEQUAL: NumEqual,
stack.NUMNOTEQUAL: NumNotEqual,
stack.BOOLAND: BoolAnd,
stack.BOOLOR: BoolOr,
stack.LT: Lt,
stack.LTE: Lte,
stack.GT: Gt,
stack.GTE: Gte,
2019-03-28 22:28:20 +00:00
stack.SHR: Shr,
stack.SHL: Shl,
stack.INC: Inc,
stack.DEC: Dec,
2019-03-28 20:32:32 +00:00
stack.DIV: Div,
stack.MOD: Mod,
2019-03-28 19:47:47 +00:00
stack.NZ: Nz,
stack.MUL: Mul,
stack.ABS: Abs,
stack.NOT: Not,
stack.SIGN: Sign,
stack.NEGATE: Negate,
stack.ADD: Add,
stack.SUB: Sub,
stack.PUSHBYTES1: PushNBytes,
stack.PUSHBYTES75: PushNBytes,
2019-03-16 22:15:08 +00:00
stack.RET: RET,
stack.EQUAL: EQUAL,
stack.THROWIFNOT: THROWIFNOT,
stack.THROW: THROW,
}
func init() {
for i := int(stack.PUSHBYTES1); i <= int(stack.PUSHBYTES75); i++ {
opFunc[stack.Instruction(i)] = PushNBytes
}
}