Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch:
Changeset: r93765:124c875dc8d6
Date: 2018-02-05 13:22 +0100
http://bitbucket.org/pypy/pypy/changeset/124c875dc8d6/
Log: Backed out changeset 864485a54ece
diff --git a/rpython/rlib/rbigint.py b/rpython/rlib/rbigint.py
--- a/rpython/rlib/rbigint.py
+++ b/rpython/rlib/rbigint.py
@@ -762,10 +762,12 @@
@jit.elidable
def floordiv(self, other):
- if other.numdigits() == 1:
- otherint = other.digit(0) * other.sign
- assert int_in_valid_range(otherint)
- return self.int_floordiv(otherint)
+ if self.sign == 1 and other.numdigits() == 1 and other.sign == 1:
+ digit = other.digit(0)
+ if digit == 1:
+ return rbigint(self._digits[:self.size], 1, self.size)
+ elif digit and digit & (digit - 1) == 0:
+ return self.rshift(ptwotable[digit])
div, mod = _divrem(self, other)
if mod.sign * other.sign == -1:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit