summaryrefslogtreecommitdiffstats
path: root/llvm
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
commit0a12e95362da11262673d7417228678b2928df7b (patch)
tree4a70c15b1f14765b5708fbb19bf923a960609e90 /llvm
parentd6d55eeef587e617ce08cbe38d48b3c528cb5abb (diff)
downloadbcm5719-llvm-0a12e95362da11262673d7417228678b2928df7b.tar.gz
bcm5719-llvm-0a12e95362da11262673d7417228678b2928df7b.zip
Fix isIntN to work with APInts > 64 bits. This method is only
used by clang apparently. llvm-svn: 60446
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/ADT/APInt.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 1799b21b183..3c16b3841ef 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/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.
OpenPOWER on IntegriCloud