Skip to content

Commit b403ec5

Browse files
committed
Merge #9916: Fix msvc compiler error C4146 (minus operator applied to unsigned type)
8e0720b Fix msvc compiler error C4146 (unary minus operator applied to unsigned type) (kobake) 292112f Fix msvc compiler error C4146 (minus operator applied to unsigned type) (kobake) Tree-SHA512: 25f408daf7bf9ffe4b8b4bd62f6f6d326219189a9faf8f8c0a135c5a0cb0511af765aa2b6087a091c8863c701289bda49a2379b00cd9b10854d316a5c3fc3f8e
2 parents 02bd6e9 + 8e0720b commit b403ec5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
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];

src/test/util_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ BOOST_AUTO_TEST_CASE(test_ParseInt32)
321321
BOOST_CHECK(ParseInt32("1234", &n) && n == 1234);
322322
BOOST_CHECK(ParseInt32("01234", &n) && n == 1234); // no octal
323323
BOOST_CHECK(ParseInt32("2147483647", &n) && n == 2147483647);
324-
BOOST_CHECK(ParseInt32("-2147483648", &n) && n == -2147483648);
324+
BOOST_CHECK(ParseInt32("-2147483648", &n) && n == (-2147483647 - 1)); // (-2147483647 - 1) equals INT_MIN
325325
BOOST_CHECK(ParseInt32("-1234", &n) && n == -1234);
326326
// Invalid values
327327
BOOST_CHECK(!ParseInt32("", &n));

0 commit comments

Comments
 (0)