aboutsummaryrefslogtreecommitdiff
path: root/py/bc0.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-09-02 21:35:26 +1000
committerDamien George <damien.p.george@gmail.com>2019-09-26 15:27:11 +1000
commit1f7202d122a478b0c8cedcf7cf252849b2d3d881 (patch)
tree3dc90802a8704a4995cf0c41244be946b3bbe12b /py/bc0.h
parent67fdfebe645d5df69cfa01b81a6776ecae3b6625 (diff)
py/bc: Replace big opcode format table with simple macro.
Diffstat (limited to 'py/bc0.h')
-rw-r--r--py/bc0.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/py/bc0.h b/py/bc0.h
index 857b75db9..96f9f2136 100644
--- a/py/bc0.h
+++ b/py/bc0.h
@@ -31,6 +31,14 @@
#define MP_BC_MASK_FORMAT (0xf0)
#define MP_BC_MASK_EXTRA_BYTE (0x9e)
+#define MP_BC_FORMAT_BYTE (0)
+#define MP_BC_FORMAT_QSTR (1)
+#define MP_BC_FORMAT_VAR_UINT (2)
+#define MP_BC_FORMAT_OFFSET (3)
+
+// Nibbles in magic number are: BB BB BB BB BB BO VV QU
+#define MP_BC_FORMAT(op) ((0x000003a4 >> (2 * ((op) >> 4))) & 3)
+
// Load, Store, Delete, Import, Make, Build, Unpack, Call, Jump, Exception, For, sTack, Return, Yield, Op
#define MP_BC_BASE_RESERVED (0x00) // ----------------
#define MP_BC_BASE_QSTR_O (0x10) // LLLLLLSSSDDII---