[pypy-svn] r65188 - pypy/branch/js-refactoring/pypy/lang/js
jandem at codespeak.net
jandem at codespeak.net
Sat May 9 19:32:43 CEST 2009
Author: jandem
Date: Sat May 9 19:32:40 2009
New Revision: 65188
Modified:
pypy/branch/js-refactoring/pypy/lang/js/jscode.py
pypy/branch/js-refactoring/pypy/lang/js/operations.py
Log:
implement bitwise not (~)
Modified: pypy/branch/js-refactoring/pypy/lang/js/jscode.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/jscode.py (original)
+++ pypy/branch/js-refactoring/pypy/lang/js/jscode.py Sat May 9 19:32:40 2009
@@ -468,6 +468,11 @@
def operation(self, ctx, op1, op2):
return W_IntNumber(op1|op2)
+class BITNOT(BaseUnaryOperation):
+ def eval(self, ctx, stack):
+ op = stack.pop().ToInt32(ctx)
+ stack.append(W_IntNumber(~op))
+
class URSH(BaseBinaryBitwiseOp):
def eval(self, ctx, stack):
op2 = stack.pop().ToUInt32(ctx)
Modified: pypy/branch/js-refactoring/pypy/lang/js/operations.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/operations.py (original)
+++ pypy/branch/js-refactoring/pypy/lang/js/operations.py Sat May 9 19:32:40 2009
@@ -230,10 +230,7 @@
BitwiseXor = create_binary_op('BITXOR')
BitwiseOr = create_binary_op('BITOR')
-#class BitwiseNot(UnaryOp):
-# def eval(self, ctx):
-# op1 = self.expr.eval(ctx).GetValue().ToInt32()
-# return W_IntNumber(~op1)
+BitwiseNot = create_unary_op('BITNOT')
class Unconditional(Statement):
def __init__(self, pos, target):
More information about the Pypy-commit
mailing list