summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/ADT/APInt.h10
1 files changed, 9 insertions, 1 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.
///
OpenPOWER on IntegriCloud