[issue3944] faster long multiplication

Pernici Mario report at bugs.python.org
Wed Sep 24 17:57:55 CEST 2008


Pernici Mario <pernici at users.sourceforge.net> added the comment:

Yes, I think that the speed-up is due to reducing the number of 
shifts and masks.

Changing PyLong_SHIFT to 16 would be complicated; for instance in 
v_iadd() carry could not be a digit of 16 bits anymore; writing code
specific for 64 bit machines would surely improve performance;
maybe with PyLong_SHIFT=30 few changes to the code would be needed?

I did not modify the case a = b.

I changed the documentation, which was wrong,
adding detailed bounds on carry
in the various steps to check that it does not overflow.
I corrected the wrong assertion (carry <= PyLong_MASK).

----------
keywords: +patch
Added file: http://bugs.python.org/file11595/longobject1.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3944>
_______________________________________


More information about the Python-bugs-list mailing list