aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT/APInt.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-02 23:33:29 +0000
committerChris Lattner <sabre@nondot.org>2008-12-02 23:33:29 +0000
commit4f0e3cbf12ac41b2bf93ea5173282eb0600b9666 (patch)
tree05b472d42c870c0bd571e398b6232524057a8222 /include/llvm/ADT/APInt.h
parent79f027da75139f2f7273f3f2fa83d1b567a1daf8 (diff)
downloadexternal_llvm-4f0e3cbf12ac41b2bf93ea5173282eb0600b9666.zip
external_llvm-4f0e3cbf12ac41b2bf93ea5173282eb0600b9666.tar.gz
external_llvm-4f0e3cbf12ac41b2bf93ea5173282eb0600b9666.tar.bz2
Fix isIntN to work with APInts > 64 bits. This method is only
used by clang apparently. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60446 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/APInt.h')
-rw-r--r--include/llvm/ADT/APInt.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h
index 1799b21..3c16b38 100644
--- a/include/llvm/ADT/APInt.h
+++ b/include/llvm/ADT/APInt.h
@@ -333,12 +333,14 @@ public:
/// @brief Check if this APInt has an N-bits unsigned integer value.
bool isIntN(uint32_t N) const {
assert(N && "N == 0 ???");
- if (isSingleWord()) {
+ if (N >= getBitWidth())
+ return true;
+
+ if (isSingleWord())
return VAL == (VAL & (~0ULL >> (64 - N)));
- } else {
- APInt Tmp(N, getNumWords(), pVal);
- return Tmp == (*this);
- }
+ APInt Tmp(N, getNumWords(), pVal);
+ Tmp.zext(getBitWidth());
+ return Tmp == (*this);
}
/// @brief Check if this APInt has an N-bits signed integer value.