diff --git a/libluna/include/luna/HashTable.h b/libluna/include/luna/HashTable.h index 18e255bb..a29e86d7 100644 --- a/libluna/include/luna/HashTable.h +++ b/libluna/include/luna/HashTable.h @@ -21,6 +21,7 @@ template class HashTable { static constexpr usize GROW_RATE = 2; static constexpr usize GROW_FACTOR = 2; + static constexpr usize INITIAL_CAPACITY = 32; public: /** @@ -43,7 +44,7 @@ template class HashTable */ Result try_set(T&& value) { - if (should_grow()) TRY(rehash(m_capacity * GROW_FACTOR)); + if (should_grow()) TRY(rehash(m_capacity ? m_capacity * GROW_FACTOR : INITIAL_CAPACITY)); u64 index = hash(value, m_salt) % m_capacity;