Union our bitmap with the RHS and return true if we changed.
| 555 | |
| 556 | // Union our bitmap with the RHS and return true if we changed. |
| 557 | bool operator|=(const SparseBitVector &RHS) { |
| 558 | if (this == &RHS) |
| 559 | return false; |
| 560 | |
| 561 | bool changed = false; |
| 562 | ElementListIter Iter1 = Elements.begin(); |
| 563 | ElementListConstIter Iter2 = RHS.Elements.begin(); |
| 564 | |
| 565 | // If RHS is empty, we are done |
| 566 | if (RHS.Elements.empty()) |
| 567 | return false; |
| 568 | |
| 569 | while (Iter2 != RHS.Elements.end()) { |
| 570 | if (Iter1 == Elements.end() || Iter1->index() > Iter2->index()) { |
| 571 | Elements.insert(Iter1, *Iter2); |
| 572 | ++Iter2; |
| 573 | changed = true; |
| 574 | } else if (Iter1->index() == Iter2->index()) { |
| 575 | changed |= Iter1->unionWith(*Iter2); |
| 576 | ++Iter1; |
| 577 | ++Iter2; |
| 578 | } else { |
| 579 | ++Iter1; |
| 580 | } |
| 581 | } |
| 582 | CurrElementIter = Elements.begin(); |
| 583 | return changed; |
| 584 | } |
| 585 | |
| 586 | // Intersect our bitmap with the RHS and return true if ours changed. |
| 587 | bool operator&=(const SparseBitVector &RHS) { |