[pypy-svn] pypy default: Test and fix on 64-bit.
arigo
commits-noreply at bitbucket.org
Sun Feb 13 15:35:24 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r41874:9f20df673030
Date: 2011-02-13 15:34 +0100
http://bitbucket.org/pypy/pypy/changeset/9f20df673030/
Log: Test and fix on 64-bit.
diff --git a/pypy/rlib/test/test_rbigint.py b/pypy/rlib/test/test_rbigint.py
--- a/pypy/rlib/test/test_rbigint.py
+++ b/pypy/rlib/test/test_rbigint.py
@@ -19,6 +19,10 @@
r2 = getattr(operator, op)(op1, op2)
assert r1.tolong() == r2
+ def test_frombool(self):
+ assert rbigint.frombool(False).tolong() == 0
+ assert rbigint.frombool(True).tolong() == 1
+
def test_str(self):
for i in range(100):
n = 3 ** i
diff --git a/pypy/rlib/rbigint.py b/pypy/rlib/rbigint.py
--- a/pypy/rlib/rbigint.py
+++ b/pypy/rlib/rbigint.py
@@ -71,6 +71,7 @@
return rffi.cast(lltype.Unsigned, x)
NULLDIGIT = _store_digit(0)
+ONEDIGIT = _store_digit(1)
def _check_digits(l):
for x in l:
@@ -151,7 +152,7 @@
def frombool(b):
if b:
- return rbigint([1], 1)
+ return rbigint([ONEDIGIT], 1)
return rbigint()
frombool = staticmethod(frombool)
More information about the Pypy-commit
mailing list