[pypy-svn] pypy jit-longlong: Add tests, and clean up unused code in src/int.h.
arigo
commits-noreply at bitbucket.org
Thu Jan 6 21:35:51 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: jit-longlong
Changeset: r40430:528bc0e4d8af
Date: 2011-01-06 21:34 +0100
http://bitbucket.org/pypy/pypy/changeset/528bc0e4d8af/
Log: Add tests, and clean up unused code in src/int.h.
diff --git a/pypy/translator/c/src/int.h b/pypy/translator/c/src/int.h
--- a/pypy/translator/c/src/int.h
+++ b/pypy/translator/c/src/int.h
@@ -104,10 +104,6 @@
OP_INT_LSHIFT(x,y,r); \
if ((x) != Py_ARITHMETIC_RIGHT_SHIFT(long, r, (y))) \
FAIL_OVF("x<<y losing bits or changing sign")
-#define OP_LLONG_LSHIFT_OVF(x,y,r) \
- OP_LLONG_LSHIFT(x,y,r); \
- if ((x) != Py_ARITHMETIC_RIGHT_SHIFT(PY_LONG_LONG, r, (y))) \
- FAIL_OVF("x<<y losing bits or changing sign")
/* floor division */
diff --git a/pypy/translator/c/test/test_typed.py b/pypy/translator/c/test/test_typed.py
--- a/pypy/translator/c/test/test_typed.py
+++ b/pypy/translator/c/test/test_typed.py
@@ -240,6 +240,21 @@
gn = self.getcompiled(g, [r_longlong], view=False)
assert gn(2147483647) == 4*2147483647
+ def g(i):
+ return i << 12
+ gn = self.getcompiled(g, [r_longlong])
+ assert gn(2147483647) == 2147483647 << 12
+
+ def g(i):
+ return i >> 12
+ gn = self.getcompiled(g, [r_longlong])
+ assert gn(-2147483647) == (-2147483647) >> 12
+
+ def g(i):
+ return i >> 12
+ gn = self.getcompiled(g, [r_ulonglong])
+ assert gn(2**64 - 12345678) == (2**64 - 12345678) >> 12
+
def test_specializing_int_functions(self):
def f(i):
return i + 1
More information about the Pypy-commit
mailing list