bpo-29782: Use __builtin_clzl for bits_in_digit if available by niklasf · Pull Request #594 · python/cpython
the code currently assumes that digit is the same as unsigned long
Ah, no. I see. This should work whenever digit is no larger than unsigned long, thanks to the implicit type conversion. However, that's probably wasteful in the majority of cases; on many (most?) machines, we should be able to use clz rather than clzl, and it may be faster. And while it's probably true that on all current platforms digit is no larger than unsigned long, that's not an assumption we should hardwire in unnecessarily.