aboutsummaryrefslogtreecommitdiff
path: root/py/vm.c
diff options
context:
space:
mode:
authorDamien2013-11-04 23:04:50 +0000
committerDamien2013-11-04 23:04:50 +0000
commit6addc89e55b56ca7f9472a80cfac1d2b4a63f4c6 (patch)
tree8db844b09d096d18264efb56147deb5616b80813 /py/vm.c
parent0c70f887340bbf39ac4fcaeef57fa359aa20d6f7 (diff)
Byte code for SMALL_INT uses 3 bytes for integer.
Diffstat (limited to 'py/vm.c')
-rw-r--r--py/vm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/py/vm.c b/py/vm.c
index 50ffbb2c9..4f9c7fbde 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -75,11 +75,11 @@ bool py_execute_byte_code_2(const byte *code, const byte **ip_in_out, py_obj_t *
break;
case PYBC_LOAD_CONST_SMALL_INT:
- snum = ip[0] | (ip[1] << 8);
+ snum = ip[0] | (ip[1] << 8) | (ip[2] << 16);
if (snum & 0x8000) {
snum |= ~0xffff;
}
- ip += 2;
+ ip += 3;
PUSH((py_obj_t)(snum << 1 | 1));
break;
@@ -162,6 +162,11 @@ bool py_execute_byte_code_2(const byte *code, const byte **ip_in_out, py_obj_t *
rt_store_name(qstr, POP());
break;
+ case PYBC_STORE_GLOBAL:
+ DECODE_QSTR;
+ rt_store_global(qstr, POP());
+ break;
+
case PYBC_STORE_ATTR:
DECODE_QSTR;
rt_store_attr(sp[0], qstr, sp[1]);