Commits

Armin Rigo committed c71578a

int_rshift needs to be there too, because 'n >> m' at app-level checks for more

Comments (0)

Files changed (3)

pypy/module/__pypy__/__init__.py

         'int_floordiv':    'interp_intop.int_floordiv',
         'int_mod':         'interp_intop.int_mod',
         'int_lshift':      'interp_intop.int_lshift',
+        'int_rshift':      'interp_intop.int_rshift',
         'uint_rshift':     'interp_intop.uint_rshift',
     }
 

pypy/module/__pypy__/interp_intop.py

     return space.wrap(llop.int_lshift(lltype.Signed, n, m))
 
 @unwrap_spec(n=int, m=int)
+def int_rshift(space, n, m):
+    return space.wrap(llop.int_rshift(lltype.Signed, n, m))
+
+@unwrap_spec(n=int, m=int)
 def uint_rshift(space, n, m):
     n = r_uint(n)
     x = llop.uint_rshift(lltype.Unsigned, n, m)

pypy/module/__pypy__/test/test_intop.py

         assert intop.int_lshift(-sys.maxint // 3, 2) == (
             self.intmask((-sys.maxint // 3) << 2))
 
+    def test_int_rshift(self):
+        from __pypy__ import intop
+        assert intop.int_rshift(42, 3) == 42 >> 3
+        assert intop.int_rshift(-42, 3) == (-42) >> 3
+        assert intop.int_rshift(0, 3333) == 0
+        assert intop.int_rshift(-1, 0) == -1
+        assert intop.int_rshift(-1, 1) == -1
+
     def test_uint_rshift(self):
         import sys
         from __pypy__ import intop
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.