diff options
author | Damien George <damien.p.george@gmail.com> | 2014-02-01 23:04:09 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-02-01 23:04:09 +0000 |
commit | 9aa2a527b532e31c77592cede3b38c018c83ac64 (patch) | |
tree | ea2c5431a7b645f4aba7d573086ada1109cbcdd1 /py/vm.c | |
parent | 7e5fb24e3bdd8a07e2c7f317ad44b62e85082547 (diff) | |
download | micropython-9aa2a527b532e31c77592cede3b38c018c83ac64.tar.gz micropython-9aa2a527b532e31c77592cede3b38c018c83ac64.zip |
py: Tidy up BINARY_OPs; negation done by special NOT bytecode.
IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new
special NOT bytecode.
Diffstat (limited to 'py/vm.c')
-rw-r--r-- | py/vm.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -428,6 +428,14 @@ unwind_jump: //sp -= 3; // pop 3 exception values break; + case MP_BC_NOT: + if (TOP() == mp_const_true) { + SET_TOP(mp_const_false); + } else { + SET_TOP(mp_const_true); + } + break; + case MP_BC_UNARY_OP: unum = *ip++; SET_TOP(rt_unary_op(unum, TOP())); |