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. (cherry picked from commit 292112f87ef1780fee6164063a60af9ee7bf3f86)
This commit is contained in:
parent
5d6fa863b3
commit
012dd8e740
|
@ -253,8 +253,8 @@ void CRollingBloomFilter::insert(const std::vector<unsigned char>& vKey)
|
|||
if (nGeneration == 4) {
|
||||
nGeneration = 1;
|
||||
}
|
||||
uint64_t nGenerationMask1 = -(uint64_t)(nGeneration & 1);
|
||||
uint64_t nGenerationMask2 = -(uint64_t)(nGeneration >> 1);
|
||||
uint64_t nGenerationMask1 = 0 - (uint64_t)(nGeneration & 1);
|
||||
uint64_t nGenerationMask2 = 0 - (uint64_t)(nGeneration >> 1);
|
||||
/* Wipe old entries that used this generation number. */
|
||||
for (uint32_t p = 0; p < data.size(); p += 2) {
|
||||
uint64_t p1 = data[p], p2 = data[p + 1];
|
||||
|
|
Loading…
Reference in New Issue