aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support
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
commit00b08ce7e67e0ce621944163255312ef3eb22808 (patch)
tree96d9fb363f32d37c2ba69af504ad1faea4140c0e /lib/Support
parent6ecce2aebc028530371888ff6981387742d8df7b (diff)
downloadexternal_llvm-00b08ce7e67e0ce621944163255312ef3eb22808.zip
external_llvm-00b08ce7e67e0ce621944163255312ef3eb22808.tar.gz
external_llvm-00b08ce7e67e0ce621944163255312ef3eb22808.tar.bz2
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')
-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 7af0101..3c83e8a 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) {