aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-01-31 17:29:02 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-01-31 17:23:54 +0100
commitfa041878de786f5be74ec74a06ec407c99ca8656 (patch)
tree05ce4c8f954a72e40465f58245d07f96156fad19 /src/common
parent0ff13913287b3874e305535c78bc43b190217168 (diff)
downloadbitcoin-fa041878de786f5be74ec74a06ec407c99ca8656.tar.xz
Fix implicit-integer-sign-change in bloom
Diffstat (limited to 'src/common')
-rw-r--r--src/common/bloom.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/bloom.cpp b/src/common/bloom.cpp
index c744d05a0e..7a3847620e 100644
--- a/src/common/bloom.cpp
+++ b/src/common/bloom.cpp
@@ -218,7 +218,7 @@ void CRollingBloomFilter::insert(Span<const unsigned char> vKey)
/* FastMod works with the upper bits of h, so it is safe to ignore that the lower bits of h are already used for bit. */
uint32_t pos = FastRange32(h, data.size());
/* The lowest bit of pos is ignored, and set to zero for the first bit, and to one for the second. */
- data[pos & ~1] = (data[pos & ~1] & ~(((uint64_t)1) << bit)) | ((uint64_t)(nGeneration & 1)) << bit;
+ data[pos & ~1U] = (data[pos & ~1U] & ~(((uint64_t)1) << bit)) | ((uint64_t)(nGeneration & 1)) << bit;
data[pos | 1] = (data[pos | 1] & ~(((uint64_t)1) << bit)) | ((uint64_t)(nGeneration >> 1)) << bit;
}
}
@@ -230,7 +230,7 @@ bool CRollingBloomFilter::contains(Span<const unsigned char> vKey) const
int bit = h & 0x3F;
uint32_t pos = FastRange32(h, data.size());
/* If the relevant bit is not set in either data[pos & ~1] or data[pos | 1], the filter does not contain vKey */
- if (!(((data[pos & ~1] | data[pos | 1]) >> bit) & 1)) {
+ if (!(((data[pos & ~1U] | data[pos | 1]) >> bit) & 1)) {
return false;
}
}