forked from OSchip/llvm-project
Add a BitVector::reset(BitVector&) method.
The alternative LHS &= ~RHS is way too slow because it creates a temporary that calls malloc/free. llvm-svn: 149187
This commit is contained in:
parent
eed64c77d2
commit
aaeaae07c4
|
@ -318,6 +318,16 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
// reset - Reset bits that are set in RHS. Same as *this &= ~RHS.
|
||||
BitVector &reset(const BitVector &RHS) {
|
||||
unsigned ThisWords = NumBitWords(size());
|
||||
unsigned RHSWords = NumBitWords(RHS.size());
|
||||
unsigned i;
|
||||
for (i = 0; i != std::min(ThisWords, RHSWords); ++i)
|
||||
Bits[i] &= ~RHS.Bits[i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
BitVector &operator|=(const BitVector &RHS) {
|
||||
if (size() < RHS.size())
|
||||
resize(RHS.size());
|
||||
|
|
Loading…
Reference in New Issue