Split out of #28674
Note that we can’t yet drop our configure checks because we pass the results on to minisketch. I’ve opened a PR for that upstream here: https://github.com/sipa/minisketch/pull/80
fanquake suggested that we simply replace our CountBits
call-sites with uses of std::bit_width
directly and just drop the tests and fuzzers. I agree with that, but I wanted to allow our tests/fuzzers to run with this change first to help convince reviewers that std::bit_width
is a drop-in replacement forCountBits
.
I can either add a commit on top of this PR to do the switch after the c-i has run or do it as a follow-up PR, I have no preference.
I was curious to see what would happen under the hood with this change. Fortunately libc++ (as an example) does exactly what one would expect, using the built-ins: https://github.com/llvm/llvm-project/blob/main/libcxx/include/__bit/countl.h#L56