diff --git a/llvm/include/llvm/ADT/Bitfields.h b/llvm/include/llvm/ADT/Bitfields.h --- a/llvm/include/llvm/ADT/Bitfields.h +++ b/llvm/include/llvm/ADT/Bitfields.h @@ -227,7 +227,7 @@ static constexpr unsigned Shift = Offset; static constexpr unsigned Bits = Size; static constexpr unsigned FirstBit = Offset; - static constexpr unsigned LastBit = Shift + Bits; + static constexpr unsigned LastBit = Shift + Bits - 1; private: template friend struct bitfields_details::Impl; @@ -273,7 +273,7 @@ /// Returns whether the two bitfields share common bits. template static constexpr bool isOverlapping() { - return A::LastBit > B::FirstBit && B::LastBit > A::FirstBit; + return A::LastBit >= B::FirstBit && B::LastBit >= A::FirstBit; } };