[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294063 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Amaury Sechet
2017-02-03 22:54:41 +00:00
parent 66d69563f7
commit 21b9ce0d3d
3 changed files with 116 additions and 0 deletions
+12
View File
@@ -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()) {