crypto: replace CountBits with std::bit_width

bit_width is a drop-in replacement with an exact meaning in c++, so there is
no need to continue testing/fuzzing/benchmarking.
This commit is contained in:
Cory Fields
2023-12-12 18:44:49 +00:00
parent 52f9bba889
commit 297367b3bb
5 changed files with 5 additions and 34 deletions

View File

@@ -7,7 +7,6 @@
#include <compat/endian.h>
#include <bit>
#include <cstdint>
#include <cstring>
@@ -83,10 +82,4 @@ void static inline WriteBE64(unsigned char* ptr, uint64_t x)
memcpy(ptr, &v, 8);
}
/** Return the smallest number n such that (x >> n) == 0 (or 64 if the highest bit in x is set. */
uint64_t static inline CountBits(uint64_t x)
{
return std::bit_width(x);
}
#endif // BITCOIN_CRYPTO_COMMON_H