File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -247,10 +247,13 @@ impl<T: Idx> BitRelations<BitSet<T>> for BitSet<T> {
247247 }
248248}
249249
250- fn sequential_update < T : Idx > ( mut f : impl FnMut ( T ) -> bool , it : impl Iterator < Item = T > ) -> bool {
250+ fn sequential_update < T : Idx > (
251+ mut self_update : impl FnMut ( T ) -> bool ,
252+ it : impl Iterator < Item = T > ,
253+ ) -> bool {
251254 let mut changed = false ;
252255 for elem in it {
253- changed |= f ( elem) ;
256+ changed |= self_update ( elem) ;
254257 }
255258 changed
256259}
@@ -342,7 +345,17 @@ impl<T: Idx> BitRelations<HybridBitSet<T>> for HybridBitSet<T> {
342345 match self {
343346 HybridBitSet :: Sparse ( self_sparse) => {
344347 match other {
345- HybridBitSet :: Sparse ( other_sparse) => self_sparse. union ( other_sparse) ,
348+ HybridBitSet :: Sparse ( other_sparse) => {
349+ // Both sets are sparse. Add the elements in
350+ // `other_sparse` to `self` one at a time. This
351+ // may or may not cause `self` to be densified.
352+ assert_eq ! ( self . domain_size( ) , other. domain_size( ) ) ;
353+ let mut changed = false ;
354+ for elem in other_sparse. iter ( ) {
355+ changed |= self . insert ( * elem) ;
356+ }
357+ changed
358+ }
346359
347360 HybridBitSet :: Dense ( other_dense) => {
348361 // `self` is sparse and `other` is dense. To
You can’t perform that action at this time.
0 commit comments