libluna: Some fixes so that HashTable collisions work properly

This commit is contained in:
apio 2023-07-21 21:04:25 +02:00
parent 4439ef8ec6
commit 16b385fc7b
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -48,12 +48,13 @@ template <typename T> class HashTable
usize i = index;
do {
auto& bucket = m_buckets[index];
auto& bucket = m_buckets[i];
if (bucket.has_value())
{
if (*bucket == value) return bucket.value_ptr();
i++;
}
else
return nullptr;
} while (i != index);
@ -70,7 +71,7 @@ template <typename T> class HashTable
usize i = index;
do {
auto& bucket = m_buckets[index];
auto& bucket = m_buckets[i];
if (bucket.has_value())
{
if (*bucket == value)
@ -82,6 +83,7 @@ template <typename T> class HashTable
}
i++;
}
else
return false;
} while (i != index);