This repository was archived by the owner on May 28, 2025. It is now read-only.
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> {
247
247
}
248
248
}
249
249
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 {
251
254
let mut changed = false ;
252
255
for elem in it {
253
- changed |= f ( elem) ;
256
+ changed |= self_update ( elem) ;
254
257
}
255
258
changed
256
259
}
@@ -342,7 +345,17 @@ impl<T: Idx> BitRelations<HybridBitSet<T>> for HybridBitSet<T> {
342
345
match self {
343
346
HybridBitSet :: Sparse ( self_sparse) => {
344
347
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
+ }
346
359
347
360
HybridBitSet :: Dense ( other_dense) => {
348
361
// `self` is sparse and `other` is dense. To
You can’t perform that action at this time.
0 commit comments