Author: stian
Branch: math-improvements
Changeset: r92804:0f49fdf5b940
Date: 2017-10-19 23:03 +0200
http://bitbucket.org/pypy/pypy/changeset/0f49fdf5b940/

Log:    Avoid copy if the sign stay the same in int_mul

diff --git a/rpython/rlib/rbigint.py b/rpython/rlib/rbigint.py
--- a/rpython/rlib/rbigint.py
+++ b/rpython/rlib/rbigint.py
@@ -742,6 +742,8 @@
         bsign = -1 if b < 0 else 1
 
         if digit == 1:
+            if self.sign == bsign:
+                return self
             return rbigint(self._digits[:self.numdigits()], self.sign * bsign, 
asize)
         elif asize == 1:
             res = self.widedigit(0) * digit
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to