3 ms·
It does. Note that it calls popcount_digit on each digit of the integer (a 'digit' here is 32 bits), which calls _Py_popcount32, which does map to a hardware in
by orlp 4y ago
It does. Note that it calls popcount_digit on each digit of the integer (a 'digit' here is 32 bits), which calls _Py_popcount32, which does map to a hardware instruction if possible: https://github.com/python/cpython/blob/f62ad4f2c4214fdc05cc45c27a5c068553c7942c/Include/internal/pycore_bitutils.h#L95 https://github.com/python/cpython/blob/f62ad4f2c4214fdc05cc4...
- saagarjha 4y agoAh, you are correct. Although I still take issue with "fast" in the comment I was replying to ;)