STINNER Victor <vstin...@python.org> added the comment:

"On BSD, there's a library function called fls() that we could use, and GCC 
provides __builtin_clz()."

See also rejected bpo-29782 and GH-594.

If someone wants to experiment that, I suggest to add 
Include/internal/pycore_pymath.h, move _Py_bit_length() there and convert it to 
a static inline function.

Since the code is now unified, it makes a little bit more sense to add 
specialized code, *if* the code is not too complex.

I'm still not sure that GH-594 is worth it, since it was not possible to see 
the speedup on a microbenchmark :-(

----------

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

Reply via email to