Skip to content

Commit 292112f

Browse files
committed
Fix msvc compiler error C4146 (minus operator applied to unsigned type)
On msvc14, the compiler error C4146 (unary minus operator applied to unsigned type, result still unsigned) had been occured. Use '0 - x' styled formula instead of '-x' so as to fix the error.
1 parent d978c41 commit 292112f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/bloom.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ void CRollingBloomFilter::insert(const std::vector<unsigned char>& vKey)
254254
if (nGeneration == 4) {
255255
nGeneration = 1;
256256
}
257-
uint64_t nGenerationMask1 = -(uint64_t)(nGeneration & 1);
258-
uint64_t nGenerationMask2 = -(uint64_t)(nGeneration >> 1);
257+
uint64_t nGenerationMask1 = 0 - (uint64_t)(nGeneration & 1);
258+
uint64_t nGenerationMask2 = 0 - (uint64_t)(nGeneration >> 1);
259259
/* Wipe old entries that used this generation number. */
260260
for (uint32_t p = 0; p < data.size(); p += 2) {
261261
uint64_t p1 = data[p], p2 = data[p + 1];

0 commit comments

Comments
 (0)