Author: stian
Branch: math-improvements
Changeset: r92983:5c8e47fa96a6
Date: 2017-11-09 19:08 +0100
http://bitbucket.org/pypy/pypy/changeset/5c8e47fa96a6/

Log:    Dont need widedigit | widedigit, when widedigit | digit will do.

diff --git a/rpython/rlib/rbigint.py b/rpython/rlib/rbigint.py
--- a/rpython/rlib/rbigint.py
+++ b/rpython/rlib/rbigint.py
@@ -2049,7 +2049,7 @@
         * result in z[0:m], and return the d bits shifted out of the top.
     """
 
-    carry = _unsigned_widen_digit(0)
+    carry = 0
     #assert 0 <= d and d < SHIFT
     i = 0
     while i < m:
@@ -2072,7 +2072,7 @@
     #assert 0 <= d and d < SHIFT
     i = m-1
     while i >= 0:
-        acc = (carry << SHIFT) | a.uwidedigit(i)
+        acc = (carry << SHIFT) | a.udigit(i)
         carry = acc & mask
         z.setdigit(i, acc >> d)
         i -= 1
@@ -2127,10 +2127,10 @@
         else:
             vtop = v.widedigit(j) << SHIFT
         #assert vtop <= wm1
-        vv = vtop | v.widedigit(abs(j-1))
+        vv = vtop | v.digit(abs(j-1))
         q = vv / wm1
         r = vv % wm1 # This seems to be slightly faster than on widen digits 
than vv - wm1 * q.
-        vj2 = v.widedigit(abs(j-2))
+        vj2 = v.digit(abs(j-2))
         while wm2 * q > ((r << SHIFT) | vj2):
             q -= 1
             r += wm1
diff --git a/rpython/rlib/test/test_rbigint.py 
b/rpython/rlib/test/test_rbigint.py
--- a/rpython/rlib/test/test_rbigint.py
+++ b/rpython/rlib/test/test_rbigint.py
@@ -144,7 +144,7 @@
                 rl_op2 = rbigint.fromlong(op2)
                 r1 = rl_op1.mod(rl_op2)
                 r2 = op1 % op2
-                print op1, op2
+                
                 assert r1.tolong() == r2
 
     def test_int_mod(self):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to