Skip to content

Commit

Permalink
contains -> insert
Browse files Browse the repository at this point in the history
  • Loading branch information
lmondada committed Sep 25, 2023
1 parent 60bf9e3 commit d1862d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/optimiser/taso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ where
let new_circ_cost = (self.cost)(&new_circ);
circ_cnt += 1;
logger.log_progress(circ_cnt, Some(pq.len()), seen_hashes.len());
if seen_hashes.contains(new_circ_hash, new_circ_cost) {
if !seen_hashes.insert(new_circ_hash, new_circ_cost) {
continue;
}
pq.push_unchecked(new_circ, new_circ_hash, new_circ_cost);
Expand Down
3 changes: 2 additions & 1 deletion src/optimiser/taso/hugr_hash_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ impl HugrHashSet {
self.buckets[bucket_index].insert(hash)
}

/// Returns whether the given hash is present in the set.
// /// Returns whether the given hash is present in the set.
#[allow(dead_code)]
pub(super) fn contains(&self, hash: u64, cost: usize) -> bool {
let Some(min_cost) = self.min_cost else {
return false;
Expand Down

0 comments on commit d1862d8

Please sign in to comment.