aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/APInt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/APInt.cpp')
-rw-r--r--lib/Support/APInt.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp
index a515366db2..c8ab2d762b 100644
--- a/lib/Support/APInt.cpp
+++ b/lib/Support/APInt.cpp
@@ -726,7 +726,10 @@ uint32_t APInt::countLeadingZeros() const {
}
}
}
- return Count - (APINT_BITS_PER_WORD - (BitWidth % APINT_BITS_PER_WORD));
+ uint32_t remainder = BitWidth % APINT_BITS_PER_WORD;
+ if (remainder)
+ Count -= APINT_BITS_PER_WORD - remainder;
+ return Count;
}
/// countTrailingZeros - This function is a APInt version corresponding to