Skip to content

Commit

Permalink
fix capacity shenanigans in bit_tree
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshuawuyts committed May 4, 2024
1 parent daf3a8d commit 30aef07
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/indexer/bit_tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ impl BitVec {
/// Insert an entry into the index
#[inline]
pub(crate) fn insert(&mut self, index: usize) {
debug_assert!(
index < self.capacity(),
"Write at index {index} is out of bounds"
);
if index >= self.capacity() {
self.resize(self.capacity() * 2);
}
let (index, mask) = compute_index(index);
self.entries[index] |= mask;
self.count += 1;
Expand All @@ -94,8 +93,9 @@ impl BitVec {
/// Clear the entire index
#[inline]
pub(crate) fn clear(&mut self) {
self.count = 0;
self.entries.fill(0);
self.tree.fill(0);
self.count = 0;
}

/// Returns `true` if the index contains a value
Expand Down

0 comments on commit 30aef07

Please sign in to comment.