Author: stian
Branch: math-improvements
Changeset: r92994:22373c826010
Date: 2017-11-12 10:29 +0100
http://bitbucket.org/pypy/pypy/changeset/22373c826010/

Log:    Provide two assets to make better code in long multidigit division

diff --git a/rpython/rlib/rbigint.py b/rpython/rlib/rbigint.py
--- a/rpython/rlib/rbigint.py
+++ b/rpython/rlib/rbigint.py
@@ -2130,8 +2130,11 @@
             vtop = 0
         else:
             vtop = v.widedigit(j) << SHIFT
-        #assert vtop <= wm1
+
         vv = vtop | v.digit(abs(j-1))
+        # These two hints to make division just as fast as doing it unsigned.
+        assert vv >= 0
+        assert wm1 >= 1
         q = vv / wm1
         r = vv % wm1 # This seems to be slightly faster than on widen digits 
than vv - wm1 * q.
         vj2 = v.digit(abs(j-2))
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to