diff --git a/src/common/bitfield_util.cc b/src/common/bitfield_util.cc index 8cbe73c8908..bd8a549fd56 100644 --- a/src/common/bitfield_util.cc +++ b/src/common/bitfield_util.cc @@ -35,6 +35,7 @@ static uint64_t WrappedSignedBitfieldPlus(uint64_t value, int64_t incr, uint8_t return res; } +// See also https://github.com/redis/redis/blob/7f4bae817614988c43c3024402d16edcbf3b3277/src/bitops.c#L325 StatusOr SignedBitfieldPlus(uint64_t value, int64_t incr, uint8_t bits, BitfieldOverflowBehavior overflow, uint64_t *dst) { Status bits_status(BitfieldEncoding::CheckSupportedBitLengths(BitfieldEncoding::Type::kSigned, bits)); @@ -84,7 +85,7 @@ static uint64_t WrappedUnsignedBitfieldPlus(uint64_t value, int64_t incr, uint8_ return res; } -// return true if overflow. +// See also https://github.com/redis/redis/blob/7f4bae817614988c43c3024402d16edcbf3b3277/src/bitops.c#L288 StatusOr UnsignedBitfieldPlus(uint64_t value, int64_t incr, uint8_t bits, BitfieldOverflowBehavior overflow, uint64_t *dst) { Status bits_status(BitfieldEncoding::CheckSupportedBitLengths(BitfieldEncoding::Type::kUnsigned, bits)); diff --git a/src/common/bitfield_util.h b/src/common/bitfield_util.h index 08afb18204d..dbb44b1db76 100644 --- a/src/common/bitfield_util.h +++ b/src/common/bitfield_util.h @@ -243,7 +243,7 @@ class ArrayBitfieldBitmap { // for a bits of k signed number, 1 << (bits - 1) is the MSB (most-significant bit). // the number is a negative when the MSB is "1". - auto msb = static_cast(1) << (bits - 1); + auto msb = static_cast(1) << (bits - 1); // NOLINT if ((value & msb) != 0) { // The way of enlarge width of a signed integer is sign-extended. // The values of higher bits should all "1", when the number is negative.