Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r65460:c71578a1ec52 Date: 2013-07-18 18:34 +0200 http://bitbucket.org/pypy/pypy/changeset/c71578a1ec52/
Log: int_rshift needs to be there too, because 'n >> m' at app-level checks for more diff --git a/pypy/module/__pypy__/__init__.py b/pypy/module/__pypy__/__init__.py --- a/pypy/module/__pypy__/__init__.py +++ b/pypy/module/__pypy__/__init__.py @@ -45,6 +45,7 @@ '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', } diff --git a/pypy/module/__pypy__/interp_intop.py b/pypy/module/__pypy__/interp_intop.py --- a/pypy/module/__pypy__/interp_intop.py +++ b/pypy/module/__pypy__/interp_intop.py @@ -29,6 +29,10 @@ 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) diff --git a/pypy/module/__pypy__/test/test_intop.py b/pypy/module/__pypy__/test/test_intop.py --- a/pypy/module/__pypy__/test/test_intop.py +++ b/pypy/module/__pypy__/test/test_intop.py @@ -79,6 +79,14 @@ 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 _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit