Addd missing domain size assertions
This commit is contained in:
parent
c7357270b8
commit
86bd551e4c
1 changed files with 3 additions and 1 deletions
|
@ -289,6 +289,7 @@ fn dense_sparse_intersect<T: Idx>(
|
||||||
// hybrid REL dense
|
// hybrid REL dense
|
||||||
impl<T: Idx> BitRelations<BitSet<T>> for HybridBitSet<T> {
|
impl<T: Idx> BitRelations<BitSet<T>> for HybridBitSet<T> {
|
||||||
fn union(&mut self, other: &BitSet<T>) -> bool {
|
fn union(&mut self, other: &BitSet<T>) -> bool {
|
||||||
|
assert_eq!(self.domain_size(), other.domain_size);
|
||||||
match self {
|
match self {
|
||||||
HybridBitSet::Sparse(sparse) => {
|
HybridBitSet::Sparse(sparse) => {
|
||||||
// `self` is sparse and `other` is dense. To
|
// `self` is sparse and `other` is dense. To
|
||||||
|
@ -316,6 +317,7 @@ impl<T: Idx> BitRelations<BitSet<T>> for HybridBitSet<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn subtract(&mut self, other: &BitSet<T>) -> bool {
|
fn subtract(&mut self, other: &BitSet<T>) -> bool {
|
||||||
|
assert_eq!(self.domain_size(), other.domain_size);
|
||||||
match self {
|
match self {
|
||||||
HybridBitSet::Sparse(sparse) => {
|
HybridBitSet::Sparse(sparse) => {
|
||||||
sequential_update(|elem| sparse.remove(elem), other.iter())
|
sequential_update(|elem| sparse.remove(elem), other.iter())
|
||||||
|
@ -325,6 +327,7 @@ impl<T: Idx> BitRelations<BitSet<T>> for HybridBitSet<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn intersect(&mut self, other: &BitSet<T>) -> bool {
|
fn intersect(&mut self, other: &BitSet<T>) -> bool {
|
||||||
|
assert_eq!(self.domain_size(), other.domain_size);
|
||||||
match self {
|
match self {
|
||||||
HybridBitSet::Sparse(sparse) => sparse_intersect(sparse, |elem| other.contains(*elem)),
|
HybridBitSet::Sparse(sparse) => sparse_intersect(sparse, |elem| other.contains(*elem)),
|
||||||
HybridBitSet::Dense(dense) => dense.intersect(other),
|
HybridBitSet::Dense(dense) => dense.intersect(other),
|
||||||
|
@ -385,7 +388,6 @@ impl<T: Idx> BitRelations<HybridBitSet<T>> for HybridBitSet<T> {
|
||||||
// Both sets are sparse. Add the elements in
|
// Both sets are sparse. Add the elements in
|
||||||
// `other_sparse` to `self` one at a time. This
|
// `other_sparse` to `self` one at a time. This
|
||||||
// may or may not cause `self` to be densified.
|
// may or may not cause `self` to be densified.
|
||||||
assert_eq!(self.domain_size(), other.domain_size());
|
|
||||||
let mut changed = false;
|
let mut changed = false;
|
||||||
for elem in other_sparse.iter() {
|
for elem in other_sparse.iter() {
|
||||||
changed |= self.insert(*elem);
|
changed |= self.insert(*elem);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue