summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-03-27 18:16:17 +0000
committerCraig Topper <craig.topper@gmail.com>2017-03-27 18:16:17 +0000
commit70d8ca9276510103beb947b8ba7b365a69a2b863 (patch)
tree32c49e2bee6845d227977901ef1e980458d69e89 /llvm/include
parentf0b22c471bb787adde866e8b30b81f4754d20550 (diff)
downloadbcm5719-llvm-70d8ca9276510103beb947b8ba7b365a69a2b863.tar.gz
bcm5719-llvm-70d8ca9276510103beb947b8ba7b365a69a2b863.zip
[APInt] Move operator&=(uint64_t) inline and use memset to clear the upper words.
This method is pretty new and probably isn't use much in the code base so this should have a negligible size impact. The OR and XOR operators are already inline. llvm-svn: 298870
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