mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
Fix issue where we weren't considering 0 distance correctly
This commit is contained in:
parent
f7eb1866c2
commit
12dab0c3ba
|
@ -98,10 +98,18 @@ impl<K, V> NodeStorage<K, V> {
|
|||
let result = loop {
|
||||
let next_location = fast_mod(self.len(), (current_location + 1) as HashType);
|
||||
|
||||
// if the next node is empty, then we can clear the current node
|
||||
if self.0[next_location].is_none() {
|
||||
// if the next node is empty, or the next location has 0 distance to initial bucket then
|
||||
// we can clear the current node
|
||||
if self.0[next_location].is_none()
|
||||
|| self.0[next_location]
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.distance_to_initial_bucket
|
||||
== 0
|
||||
{
|
||||
break self.0[current_location].take().unwrap();
|
||||
}
|
||||
if self.0[next_location].is_none() {}
|
||||
|
||||
self.0.swap(current_location, next_location);
|
||||
self.0[current_location]
|
||||
|
|
Loading…
Reference in a new issue