From: Chris Lattner Date: Tue, 2 Dec 2008 23:33:29 +0000 (+0000) Subject: Fix isIntN to work with APInts > 64 bits. This method is only X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1d93b2e1b638cee7f012e8f636eb2cc137d855ff;p=oota-llvm.git 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 --- diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index 1799b21b183..3c16b3841ef 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.