mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Small fixes
This commit is contained in:
parent
2110ac303e
commit
800d6531a9
@ -271,10 +271,10 @@ fn dense_sparse_intersect<T: Idx>(
|
||||
dense: &BitSet<T>,
|
||||
sparse: &SparseBitSet<T>,
|
||||
) -> (SparseBitSet<T>, bool) {
|
||||
let n = dense.count();
|
||||
let mut sparse_copy = sparse.clone();
|
||||
sparse_intersect(&mut sparse_copy, |el| !dense.contains(*el));
|
||||
(sparse_copy, dense.count() != n)
|
||||
let n = sparse_copy.len();
|
||||
(sparse_copy, n != dense.count())
|
||||
}
|
||||
|
||||
impl<T: Idx> BitRelations<HybridBitSet<T>> for BitSet<T> {
|
||||
@ -303,7 +303,10 @@ impl<T: Idx> BitRelations<HybridBitSet<T>> for BitSet<T> {
|
||||
match other {
|
||||
HybridBitSet::Sparse(sparse) => {
|
||||
let (updated, changed) = dense_sparse_intersect(self, sparse);
|
||||
*self = updated.to_dense();
|
||||
self.clear();
|
||||
for elem in updated.iter() {
|
||||
self.insert(*elem);
|
||||
}
|
||||
changed
|
||||
}
|
||||
HybridBitSet::Dense(dense) => self.intersect(dense),
|
||||
|
Loading…
Reference in New Issue
Block a user