Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch: math-improvements
Changeset: r95479:51f9962bc56f
Date: 2018-12-13 19:56 +0100
http://bitbucket.org/pypy/pypy/changeset/51f9962bc56f/
Log: merge haeds
diff --git a/rpython/rlib/rbigint.py b/rpython/rlib/rbigint.py
--- a/rpython/rlib/rbigint.py
+++ b/rpython/rlib/rbigint.py
@@ -2073,12 +2073,15 @@
if j >= size_v:
vtop = 0
else:
- vtop = v.widedigit(j) << SHIFT
-
- vv = vtop | v.digit(abs(j-1))
+ vtop = v.widedigit(j)
+ assert vtop <= wm1
+
+ vv = (vtop << SHIFT) | v.widedigit(abs(j-1))
+
# Hints to make division just as fast as doing it unsigned. But avoids
casting to get correct results.
assert vv >= 0
assert wm1 >= 1
+
q = vv / wm1
r = vv % wm1 # This seems to be slightly faster on widen digits than
vv - wm1 * q.
vj2 = v.digit(abs(j-2))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit