aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/ADT/SparseBitVector.h
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2007-10-07 04:47:57 +0000
committerDaniel Berlin <dberlin@dberlin.org>2007-10-07 04:47:57 +0000
commitc27d61d3ae820c6b265900380487cb74fb53510c (patch)
treed80259770788f1fdf62b233b2cdcc3c490cfbd98 /include/llvm/ADT/SparseBitVector.h
parent1cf08fddc7413076dedad58dbb8d8d67e69a490f (diff)
Some more problems noticed by Curtis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42717 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/SparseBitVector.h')
-rw-r--r--include/llvm/ADT/SparseBitVector.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/llvm/ADT/SparseBitVector.h b/include/llvm/ADT/SparseBitVector.h
index 86fb2b4eb4..4e5e781eb8 100644
--- a/include/llvm/ADT/SparseBitVector.h
+++ b/include/llvm/ADT/SparseBitVector.h
@@ -648,8 +648,8 @@ public:
ElementListIter Iter1 = Elements.begin();
ElementListConstIter Iter2 = RHS.Elements.begin();
- // Check if they are both empty
- if (Elements.empty() && RHS.Elements.empty())
+ // If either our bitmap or RHS is empty, we are done
+ if (Elements.empty() || RHS.Elements.empty())
return false;
// Loop through, intersecting as we go, erasing elements when necessary.
@@ -692,8 +692,9 @@ public:
ElementListConstIter Iter1 = RHS1.Elements.begin();
ElementListConstIter Iter2 = RHS2.Elements.begin();
- // Check if they are both empty.
- if (RHS1.empty() && RHS2.empty())
+ // If RHS1 is empty, we are done
+ // If RHS2 is empty, we still have to copy RHS1
+ if (RHS1.Elements.empty())
return;
// Loop through, intersecting as we go, erasing elements when necessary.
@@ -716,6 +717,9 @@ public:
++Iter1;
++Iter2;
} else {
+ SparseBitVectorElement<ElementSize> *NewElement =
+ new SparseBitVectorElement<ElementSize>(*Iter1);
+ Elements.push_back(NewElement);
++Iter1;
}
}