libluna: Fix initial allocation for HashTable
This commit is contained in:
parent
6f3ed70363
commit
a772d92e6f
@ -21,6 +21,7 @@ template <typename T> 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 <typename T> class HashTable
|
||||
*/
|
||||
Result<bool> 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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user