fix some compiler warnings

This commit is contained in:
Pierre Chapuis 2016-06-05 15:34:43 +02:00 committed by antirez
parent 3fd4baf1e7
commit a650aaaf4f

View File

@ -299,7 +299,7 @@ int checkUnsignedBitfieldOverflow(uint64_t value, int64_t incr, uint64_t bits, i
handle_wrap: handle_wrap:
{ {
uint64_t mask = ((int64_t)-1) << bits; uint64_t mask = ((uint64_t)-1) << bits;
uint64_t res = value+incr; uint64_t res = value+incr;
res &= ~mask; res &= ~mask;
@ -342,7 +342,7 @@ int checkSignedBitfieldOverflow(int64_t value, int64_t incr, uint64_t bits, int
handle_wrap: handle_wrap:
{ {
uint64_t mask = ((int64_t)-1) << bits; uint64_t mask = ((uint64_t)-1) << bits;
uint64_t msb = (uint64_t)1 << (bits-1); uint64_t msb = (uint64_t)1 << (bits-1);
uint64_t a = value, b = incr, c; uint64_t a = value, b = incr, c;
c = a+b; /* Perform addition as unsigned so that's defined. */ c = a+b; /* Perform addition as unsigned so that's defined. */