Author: stian Branch: improve-rbigint Changeset: r56330:ea6df5628183 Date: 2012-06-25 02:30 +0200 http://bitbucket.org/pypy/pypy/changeset/ea6df5628183/
Log: Fix a bug with floordiv caused by my power of two code that allowed div by 0 diff --git a/pypy/rlib/rbigint.py b/pypy/rlib/rbigint.py --- a/pypy/rlib/rbigint.py +++ b/pypy/rlib/rbigint.py @@ -414,10 +414,9 @@ def floordiv(self, other): if other.numdigits() == 1 and other.sign == 1: digit = other.digit(0) - if digit == 1: return self - elif digit & (digit - 1) == 0: + elif digit and digit & (digit - 1) == 0: div = self.rshift(ptwotable[digit]) return div _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit