[pypy-commit] pypy math-improvements: Don't return a copy on long // 1

stian pypy.commits at gmail.com
Tue Nov 14 05:19:03 EST 2017


Author: stian
Branch: math-improvements
Changeset: r93012:9838b9ca2938
Date: 2017-11-14 11:18 +0100
http://bitbucket.org/pypy/pypy/changeset/9838b9ca2938/

Log:	Don't return a copy on long // 1

diff --git a/rpython/rlib/rbigint.py b/rpython/rlib/rbigint.py
--- a/rpython/rlib/rbigint.py
+++ b/rpython/rlib/rbigint.py
@@ -788,8 +788,8 @@
         if self.sign == 1 and other.numdigits() == 1 and other.sign == 1:
             digit = other.digit(0)
             if digit == 1:
-                return rbigint(self._digits[:self.numdigits()], 1, self.numdigits())
-            elif digit and digit & (digit - 1) == 0:
+                return self
+            elif digit & (digit - 1) == 0:
                 return self.rqshift(ptwotable[digit])
 
         div, mod = _divrem(self, other)


More information about the pypy-commit mailing list