mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
Make SparseBitVector::set actually work properly when sets are not in ascending or descending order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42604 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3b802476d2
commit
c3a32d190c
@ -334,9 +334,8 @@ class SparseBitVector {
|
||||
--ElementIter;
|
||||
} else {
|
||||
while (ElementIter != Elements.end() &&
|
||||
ElementIter->index() <= ElementIndex)
|
||||
ElementIter->index() < ElementIndex)
|
||||
++ElementIter;
|
||||
--ElementIter;
|
||||
}
|
||||
CurrElementIter = ElementIter;
|
||||
return ElementIter;
|
||||
@ -536,10 +535,17 @@ public:
|
||||
if (ElementIter == Elements.end() ||
|
||||
ElementIter->index() != ElementIndex) {
|
||||
Element = new SparseBitVectorElement<ElementSize>(ElementIndex);
|
||||
// Insert does insert before, and lower bound gives the one before.
|
||||
ElementIter = Elements.insert(++ElementIter, Element);
|
||||
// We may have hit the beginning of our SparseBitVector, in which case,
|
||||
// we may need to insert right after this element, which requires moving
|
||||
// the current iterator forward one, because insert does insert before.
|
||||
if (ElementIter->index() < ElementIndex)
|
||||
ElementIter = Elements.insert(++ElementIter, Element);
|
||||
else
|
||||
ElementIter = Elements.insert(ElementIter, Element);
|
||||
}
|
||||
}
|
||||
CurrElementIter = ElementIter;
|
||||
|
||||
ElementIter->set(Idx % ElementSize);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user