Browse Source

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
0.15
Wladimir J. van der Laan 8 years ago
parent
commit
b403ec5c0f
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 4
      src/bloom.cpp
  2. 2
      src/test/util_tests.cpp

4
src/bloom.cpp

@ -254,8 +254,8 @@ void CRollingBloomFilter::insert(const std::vector<unsigned char>& vKey)
if (nGeneration == 4) { if (nGeneration == 4) {
nGeneration = 1; nGeneration = 1;
} }
uint64_t nGenerationMask1 = -(uint64_t)(nGeneration & 1); uint64_t nGenerationMask1 = 0 - (uint64_t)(nGeneration & 1);
uint64_t nGenerationMask2 = -(uint64_t)(nGeneration >> 1); uint64_t nGenerationMask2 = 0 - (uint64_t)(nGeneration >> 1);
/* Wipe old entries that used this generation number. */ /* Wipe old entries that used this generation number. */
for (uint32_t p = 0; p < data.size(); p += 2) { for (uint32_t p = 0; p < data.size(); p += 2) {
uint64_t p1 = data[p], p2 = data[p + 1]; uint64_t p1 = data[p], p2 = data[p + 1];

2
src/test/util_tests.cpp

@ -321,7 +321,7 @@ BOOST_AUTO_TEST_CASE(test_ParseInt32)
BOOST_CHECK(ParseInt32("1234", &n) && n == 1234); BOOST_CHECK(ParseInt32("1234", &n) && n == 1234);
BOOST_CHECK(ParseInt32("01234", &n) && n == 1234); // no octal BOOST_CHECK(ParseInt32("01234", &n) && n == 1234); // no octal
BOOST_CHECK(ParseInt32("2147483647", &n) && n == 2147483647); BOOST_CHECK(ParseInt32("2147483647", &n) && n == 2147483647);
BOOST_CHECK(ParseInt32("-2147483648", &n) && n == -2147483648); BOOST_CHECK(ParseInt32("-2147483648", &n) && n == (-2147483647 - 1)); // (-2147483647 - 1) equals INT_MIN
BOOST_CHECK(ParseInt32("-1234", &n) && n == -1234); BOOST_CHECK(ParseInt32("-1234", &n) && n == -1234);
// Invalid values // Invalid values
BOOST_CHECK(!ParseInt32("", &n)); BOOST_CHECK(!ParseInt32("", &n));

Loading…
Cancel
Save