diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-01-20 15:25:33 -0500 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-01-21 10:36:14 +0100 |
commit | 4f5353cbb8f01e17d0cc09a0244d9dc2ef4c37f2 (patch) | |
tree | aa52063ad49ff21d9b0ef4ae0797283063130f7f /AK | |
parent | dbc04bbf1ba6c5c2a00459262423dccdadcab403 (diff) | |
download | serenity-4f5353cbb8f01e17d0cc09a0244d9dc2ef4c37f2.zip |
AK: Rename double_hash to rehash_for_collision
The name is currently quite confusing as it indicates it hashes doubles.
Diffstat (limited to 'AK')
-rw-r--r-- | AK/HashFunctions.h | 2 | ||||
-rw-r--r-- | AK/HashTable.h | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/AK/HashFunctions.h b/AK/HashFunctions.h index f20e446589..b36fd1d60a 100644 --- a/AK/HashFunctions.h +++ b/AK/HashFunctions.h @@ -19,7 +19,7 @@ constexpr unsigned int_hash(u32 key) return key; } -constexpr unsigned double_hash(u32 key) +constexpr unsigned rehash_for_collision(u32 key) { unsigned const magic = 0xBA5EDB01; if (key == magic) diff --git a/AK/HashTable.h b/AK/HashTable.h index d4238aafaf..4754e3da41 100644 --- a/AK/HashTable.h +++ b/AK/HashTable.h @@ -594,7 +594,7 @@ private: } } else if (target_bucket->state == BucketState::Rehashed) { // If the target bucket is already re-hashed, we do normal probing. - target_hash = double_hash(target_hash); + target_hash = rehash_for_collision(target_hash); target_bucket = &m_buckets[target_hash % m_capacity]; } else { VERIFY(target_bucket->state != BucketState::End); @@ -676,7 +676,7 @@ private: if (bucket.state != BucketState::Used && bucket.state != BucketState::Deleted) return nullptr; - hash = double_hash(hash); + hash = rehash_for_collision(hash); } } @@ -703,7 +703,7 @@ private: return const_cast<BucketType*>(first_empty_bucket); } - hash = double_hash(hash); + hash = rehash_for_collision(hash); } } [[nodiscard]] BucketType& lookup_for_writing(T const& value) |