diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/ADT/APInt.h | 10 | ||||
| -rw-r--r-- | llvm/lib/Support/APInt.cpp | 12 |
2 files changed, 9 insertions, 13 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h index 220e408da15..a29cfe5fbca 100644 --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/include/llvm/ADT/APInt.h @@ -691,7 +691,15 @@ public: /// Performs a bitwise AND operation on this APInt and RHS. RHS is /// logically zero-extended or truncated to match the bit-width of /// the LHS. - APInt &operator&=(uint64_t RHS); + APInt &operator&=(uint64_t RHS) { + if (isSingleWord()) { + VAL &= RHS; + return *this; + } + pVal[0] &= RHS; + memset(pVal+1, 0, (getNumWords() - 1) * APINT_WORD_SIZE); + return *this; + } /// \brief Bitwise OR assignment operator. /// diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index aacb7440313..ebcbb151867 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -428,18 +428,6 @@ APInt& APInt::operator&=(const APInt& RHS) { return *this; } -APInt &APInt::operator&=(uint64_t RHS) { - if (isSingleWord()) { - VAL &= RHS; - return *this; - } - pVal[0] &= RHS; - unsigned numWords = getNumWords(); - for (unsigned i = 1; i < numWords; ++i) - pVal[i] = 0; - return *this; -} - APInt& APInt::operator|=(const APInt& RHS) { assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); if (isSingleWord()) { |

