mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
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:
@@ -11,6 +11,7 @@
|
||||
#include <span.h>
|
||||
#include <uint256.h>
|
||||
|
||||
#include <bit>
|
||||
#include <cassert>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
@@ -203,7 +204,7 @@ public:
|
||||
{
|
||||
assert(range);
|
||||
--range;
|
||||
int bits = CountBits(range);
|
||||
int bits = std::bit_width(range);
|
||||
while (true) {
|
||||
uint64_t ret = randbits(bits);
|
||||
if (ret <= range) return ret;
|
||||
|
||||
Reference in New Issue
Block a user