getMinSignedBits needs to take into consider the sign bit when the value is positive.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41566 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-08-29 16:21:18 +00:00
parent d80fb8b366
commit cd3c4cac6e

View File

@ -856,7 +856,7 @@ public:
inline uint32_t getMinSignedBits() const {
if (isNegative())
return BitWidth - countLeadingOnes() + 1;
return getActiveBits();
return getActiveBits()+1;
}
/// This method attempts to return the value of this APInt as a zero extended