[pypy-svn] pypy ootype-virtualrefs: implement ullong_and for the cli backend

antocuni commits-noreply at bitbucket.org
Wed Apr 6 18:54:38 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: ootype-virtualrefs
Changeset: r43177:6d73aef65edf
Date: 2011-04-06 18:54 +0200
http://bitbucket.org/pypy/pypy/changeset/6d73aef65edf/

Log:	implement ullong_and for the cli backend

diff --git a/pypy/rpython/test/test_rint.py b/pypy/rpython/test/test_rint.py
--- a/pypy/rpython/test/test_rint.py
+++ b/pypy/rpython/test/test_rint.py
@@ -215,6 +215,14 @@
             assert res == f(inttype(0))
             assert type(res) == inttype
 
+    def test_and(self):
+        inttypes = [int, r_uint, r_int64, r_ulonglong]
+        for inttype in inttypes:
+            def f(a, b):
+                return a&b
+            res = self.interpret(f, [inttype(0x1234), inttype(0x00FF)])
+            assert res == f(0x1234, 0x00FF)
+
     def test_neg_abs_ovf(self):
         for op in (operator.neg, abs):
             def f(x):

diff --git a/pypy/translator/cli/opcodes.py b/pypy/translator/cli/opcodes.py
--- a/pypy/translator/cli/opcodes.py
+++ b/pypy/translator/cli/opcodes.py
@@ -267,6 +267,7 @@
     'ullong_ge':                _not('clt.un'),
     'ullong_lshift':            [PushAllArgs, 'conv.u4', 'shl'],
     'ullong_rshift':            [PushAllArgs, 'conv.i4', 'shr'],
+    'ullong_and':               'and',
 
     'oois':                     'ceq',
     'ooisnot':                  _not('ceq'),


More information about the Pypy-commit mailing list