aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/ADT/BitVector.h
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-02-10 05:54:04 +0000
committerDan Gohman <gohman@apple.com>2010-02-10 05:54:04 +0000
commite7962c9897cf3ac5fc731702d5e5d8963fc5c723 (patch)
tree8b253c5e94fde2ccd7e0e403a2d70c487832a367 /include/llvm/ADT/BitVector.h
parent5d5a1e13a129e18ee6031fe6354acd2ab4d39f37 (diff)
Implement operators |=, &=, and ^= for SmallBitVector, and remove the
restriction in BitVector for |= and ^= that the operand must be the same length. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95768 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/BitVector.h')
-rw-r--r--include/llvm/ADT/BitVector.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/llvm/ADT/BitVector.h b/include/llvm/ADT/BitVector.h
index 45108c8cc5..b9f2d83322 100644
--- a/include/llvm/ADT/BitVector.h
+++ b/include/llvm/ADT/BitVector.h
@@ -307,15 +307,17 @@ public:
}
BitVector &operator|=(const BitVector &RHS) {
- assert(Size == RHS.Size && "Illegal operation!");
- for (unsigned i = 0; i < NumBitWords(size()); ++i)
+ if (size() < RHS.size())
+ resize(RHS.size());
+ for (size_t i = 0, e = NumBitWords(RHS.size()); i != e; ++i)
Bits[i] |= RHS.Bits[i];
return *this;
}
BitVector &operator^=(const BitVector &RHS) {
- assert(Size == RHS.Size && "Illegal operation!");
- for (unsigned i = 0; i < NumBitWords(size()); ++i)
+ if (size() < RHS.size())
+ resize(RHS.size());
+ for (size_t i = 0, e = NumBitWords(RHS.size()); i != e; ++i)
Bits[i] ^= RHS.Bits[i];
return *this;
}