summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-01-29 01:29:22 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-01-29 01:29:22 +0000
commitaaeaae07c4e7689eed2f28ae7673b7df289032ed (patch)
tree701d5bbfda7d35b13bdfe30aaf4d5bbf4495a7a1
parenteed64c77d27f0b442346c35aa5cadb774ae193d4 (diff)
downloadbcm5719-llvm-aaeaae07c4e7689eed2f28ae7673b7df289032ed.tar.gz
bcm5719-llvm-aaeaae07c4e7689eed2f28ae7673b7df289032ed.zip
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
-rw-r--r--llvm/include/llvm/ADT/BitVector.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/BitVector.h b/llvm/include/llvm/ADT/BitVector.h
index 7d7afc347eb..d5f247bb22c 100644
--- a/llvm/include/llvm/ADT/BitVector.h
+++ b/llvm/include/llvm/ADT/BitVector.h
@@ -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());
OpenPOWER on IntegriCloud