summaryrefslogtreecommitdiff
path: root/include
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
commit1d93b2e1b638cee7f012e8f636eb2cc137d855ff (patch)
tree05b472d42c870c0bd571e398b6232524057a8222 /include
parent96da0419490148e42dbab6984c07e28ec66a591d (diff)
downloadllvm-1d93b2e1b638cee7f012e8f636eb2cc137d855ff.tar.gz
llvm-1d93b2e1b638cee7f012e8f636eb2cc137d855ff.tar.bz2
llvm-1d93b2e1b638cee7f012e8f636eb2cc137d855ff.tar.xz
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')
-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 1799b21b18..3c16b3841e 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.