aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-11-23 22:42:31 +0000
committerChris Lattner <sabre@nondot.org>2007-11-23 22:42:31 +0000
commit9e513acd3145036bd06b5e0f5bcc83a3e5c08854 (patch)
tree96d9fb363f32d37c2ba69af504ad1faea4140c0e /lib/Support/APInt.cpp
parent8314a0cd0ff3a1bb86bf8ab7ec6e35b232c6cb37 (diff)
Fix PR1816, by correcting the broken definition of APInt::countTrailingZeros.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44296 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APInt.cpp')
-rw-r--r--lib/Support/APInt.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp
index 7af0101ece..3c83e8a749 100644
--- a/lib/Support/APInt.cpp
+++ b/lib/Support/APInt.cpp
@@ -745,7 +745,7 @@ uint32_t APInt::countLeadingZeros() const {
uint32_t remainder = BitWidth % APINT_BITS_PER_WORD;
if (remainder)
Count -= APINT_BITS_PER_WORD - remainder;
- return Count;
+ return std::min(Count, BitWidth);
}
static uint32_t countLeadingOnes_64(uint64_t V, uint32_t skip) {