diff --git a/src/common/new_bit_field.h b/src/common/new_bit_field.h index 30acaeb288..d32ff9da10 100644 --- a/src/common/new_bit_field.h +++ b/src/common/new_bit_field.h @@ -175,6 +175,10 @@ constexpr OutputType ExtractBits(const RawType& raw) { static_assert(sizeof(RawType) == sizeof(SignedType)); constexpr auto RightShift = BitSize() - NumBits; constexpr auto LeftShift = RightShift - Position; + // C++20: Signed Integers are Two’s Complement + // Left-shift on signed integer types produces the same results as + // left-shift on the corresponding unsigned integer type. + // Right-shift is an arithmetic right shift which performs sign-extension. return AutoBitCast((AutoBitCast(raw) << LeftShift) >> RightShift); } else { using UnsignedType = SmallestUIntType()>;