We want the number of bits needed, not the power of 2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35977 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp
index a35b116..d7933fc 100644
--- a/lib/Support/APInt.cpp
+++ b/lib/Support/APInt.cpp
@@ -693,7 +693,7 @@
APInt tmp(sufficient, str, slen, radix);
// Compute how many bits are required.
- return isNegative + tmp.logBase2();
+ return isNegative + tmp.logBase2() + 1;
}
uint64_t APInt::getHashValue() const {