Serhiy Storchaka added the comment:

The accurate number of digits is (sizeof(x) * 8 + PyLong_SHIFT - 1) / 
PyLong_SHIFT or (sizeof(x) * 8 - 1) / PyLong_SHIFT + 1.

There is a similar code in _PyLong_AsUnsignedLongLongMask().

Changes of Modules/_testcapimodule.c look not related to the implementation of 
_PyLong_AsUnsignedLongMask.

Needed some results of microbenchmarking. The patch speeds up 
_PyLong_AsUnsignedLongLongMask() for very large integers, but in most cases 
this function is called for not such larger integers, and the patch adds 
additional check. We should ensure that this doesn't slow down the function.

----------
versions: +Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27298>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to