aboutsummaryrefslogtreecommitdiff
path: root/src/util/asmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/asmap.cpp')
-rw-r--r--src/util/asmap.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util/asmap.cpp b/src/util/asmap.cpp
index 360573cbae..f50cd8a28c 100644
--- a/src/util/asmap.cpp
+++ b/src/util/asmap.cpp
@@ -5,13 +5,13 @@
#include <util/asmap.h>
#include <clientversion.h>
-#include <crypto/common.h>
#include <logging.h>
#include <serialize.h>
#include <streams.h>
#include <util/fs.h>
#include <algorithm>
+#include <bit>
#include <cassert>
#include <cstdio>
#include <utility>
@@ -111,7 +111,7 @@ uint32_t Interpret(const std::vector<bool> &asmap, const std::vector<bool> &ip)
} else if (opcode == Instruction::MATCH) {
match = DecodeMatch(pos, endpos);
if (match == INVALID) break; // Match bits straddle EOF
- matchlen = CountBits(match) - 1;
+ matchlen = std::bit_width(match) - 1;
if (bits < matchlen) break; // Not enough input bits
for (uint32_t bit = 0; bit < matchlen; bit++) {
if ((ip[ip.size() - bits]) != ((match >> (matchlen - 1 - bit)) & 1)) {
@@ -175,7 +175,7 @@ bool SanityCheckASMap(const std::vector<bool>& asmap, int bits)
} else if (opcode == Instruction::MATCH) {
uint32_t match = DecodeMatch(pos, endpos);
if (match == INVALID) return false; // Match bits straddle EOF
- int matchlen = CountBits(match) - 1;
+ int matchlen = std::bit_width(match) - 1;
if (prevopcode != Instruction::MATCH) had_incomplete_match = false;
if (matchlen < 8 && had_incomplete_match) return false; // Within a sequence of matches only at most one should be incomplete
had_incomplete_match = (matchlen < 8);