From 20621e073562ee5d423b636fae8b6aa8e38275fa Mon Sep 17 00:00:00 2001 From: stefan Date: Wed, 24 May 2023 22:29:46 -0400 Subject: readme and cleanup --- vm/opcodes.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'vm/opcodes.go') diff --git a/vm/opcodes.go b/vm/opcodes.go index b3d4229..d1f6905 100644 --- a/vm/opcodes.go +++ b/vm/opcodes.go @@ -49,9 +49,18 @@ const ( PUSH30 = 0x7d PUSH31 = 0x7e PUSH32 = 0x7f + RETURN = 0xF3 //... ) func (op *Opcode) String() string { return Instructions[*op].name } + +func (o *Opcode) IsPush() byte { + d := *o - PUSH1 + if d >= 0 && d < 31 { + return byte(d) + 1 + } + return 0 +} -- cgit v1.2.3