diff options
author | Amaury Sechet <deadalnix@gmail.com> | 2017-02-03 22:54:41 +0000 |
---|---|---|
committer | Amaury Sechet <deadalnix@gmail.com> | 2017-02-03 22:54:41 +0000 |
commit | fb1756b35bd84bddfbe83fa295fb31c4682752c6 (patch) | |
tree | 68868af4eb90c77c5926d290e84e53f5e1f5b06c /llvm/lib/Support/APInt.cpp | |
parent | eeadf31de15a1ac768e132bc8c2fb72638c65af0 (diff) | |
download | bcm5719-llvm-fb1756b35bd84bddfbe83fa295fb31c4682752c6.tar.gz bcm5719-llvm-fb1756b35bd84bddfbe83fa295fb31c4682752c6.zip |
[APInt] Add integer API bor bitwise operations.
Summary: As per title. I ran into that limitation of the API doing some other work, so I though that'd be a nice addition.
Reviewers: jroelofs, compnerd, majnemer
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D29503
llvm-svn: 294063
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 0cbb93b0ca3..7b3be916f31 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -424,6 +424,18 @@ 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()) { |