[zvm] 1 new revision pushed by david.jc.anderson on 2009-05-28 01:10 GMT

2 views
Skip to first unread message

codesite...@google.com

unread,
May 27, 2009, 9:10:43 PM5/27/09
to zvm...@googlegroups.com
Revision: 3adf75b452
Author: David Anderson <da...@natulte.net>
Date: Wed May 27 18:08:36 2009
Log: Correct the implementation of op_je to handle arbitrary numbers of
args.
http://code.google.com/p/zvm/source/detail?r=3adf75b452

Modified:
/zvm/zcpu.py

=======================================
--- /zvm/zcpu.py Wed May 27 17:57:54 2009
+++ /zvm/zcpu.py Wed May 27 18:08:36 2009
@@ -184,11 +184,17 @@
##

## 2OP opcodes (opcodes 1-127 and 192-223)
- def op_je(self, a, b=None):
- """Branch if the first argument is equal to the second. Note
- that the second operand may be absent, in which case there is
- no jump."""
- self._branch(b is not None and a == b)
+ def op_je(self, a, *others):
+ """Branch if the first argument is equal to any subsequent
+ arguments. Note that the second operand may be absent, in
+ which case there is no jump."""
+ for b in others:
+ if a == b:
+ self._branch(True)
+ return
+
+ # Fallthrough: No args were equal to a.
+ self._branch(False)

def op_jl(self, a, b):
"""Branch if the first argument is less than the second."""

Reply all
Reply to author
Forward
0 new messages