[pypy-commit] pypy math-improvements: Undo this move, it is actully 50% slower for power of two calculations on single digit longs

stian pypy.commits at gmail.com
Thu Oct 19 20:07:35 EDT 2017


Author: stian
Branch: math-improvements
Changeset: r92807:bbeb35d80f5f
Date: 2017-10-20 02:05 +0200
http://bitbucket.org/pypy/pypy/changeset/bbeb35d80f5f/

Log:	Undo this move, it is actully 50% slower for power of two
	calculations on single digit longs

diff --git a/rpython/rlib/rbigint.py b/rpython/rlib/rbigint.py
--- a/rpython/rlib/rbigint.py
+++ b/rpython/rlib/rbigint.py
@@ -746,8 +746,6 @@
             if bsign == 1:
                 return self
             return rbigint(self._digits[:asize], self.sign * bsign, asize)
-        elif digit & (digit - 1) == 0:
-            result = self.lqshift(ptwotable[digit])
         elif asize == 1:
             res = self.widedigit(0) * digit
             carry = res >> SHIFT
@@ -755,6 +753,8 @@
                 return rbigint([_store_digit(res & MASK), _store_digit(carry)], self.sign * bsign, 2)
             else:
                 return rbigint([_store_digit(res & MASK)], self.sign * bsign, 1)
+        elif digit & (digit - 1) == 0:
+            result = self.lqshift(ptwotable[digit])
         else:
             result = _muladd1(self, digit)
 


More information about the pypy-commit mailing list