diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-12-02 23:33:29 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-12-02 23:33:29 +0000 |
| commit | 0a12e95362da11262673d7417228678b2928df7b (patch) | |
| tree | 4a70c15b1f14765b5708fbb19bf923a960609e90 /llvm | |
| parent | d6d55eeef587e617ce08cbe38d48b3c528cb5abb (diff) | |
| download | bcm5719-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.h | 12 |
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. |

