mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK: Remove unused rehash_for_collision
This commit is contained in:
parent
c08d137fcd
commit
4cd3a84c4b
Notes:
sideshowbarker
2024-07-17 06:51:10 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/4cd3a84c4b Pull-request: https://github.com/SerenityOS/serenity/pull/17472 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/davidot ✅
2 changed files with 0 additions and 21 deletions
|
@ -19,20 +19,6 @@ constexpr unsigned int_hash(u32 key)
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr unsigned rehash_for_collision(u32 key)
|
|
||||||
{
|
|
||||||
unsigned const magic = 0xBA5EDB01;
|
|
||||||
if (key == magic)
|
|
||||||
return 0u;
|
|
||||||
if (key == 0u)
|
|
||||||
key = magic;
|
|
||||||
|
|
||||||
key ^= key << 13;
|
|
||||||
key ^= key >> 17;
|
|
||||||
key ^= key << 5;
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr unsigned pair_int_hash(u32 key1, u32 key2)
|
constexpr unsigned pair_int_hash(u32 key1, u32 key2)
|
||||||
{
|
{
|
||||||
return int_hash((int_hash(key1) * 209) ^ (int_hash(key2 * 413)));
|
return int_hash((int_hash(key1) * 209) ^ (int_hash(key2 * 413)));
|
||||||
|
|
|
@ -15,13 +15,6 @@ TEST_CASE(int_hash)
|
||||||
static_assert(int_hash(0) == 1177991625u);
|
static_assert(int_hash(0) == 1177991625u);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(rehash_for_collision)
|
|
||||||
{
|
|
||||||
static_assert(rehash_for_collision(666) == 171644115u);
|
|
||||||
static_assert(rehash_for_collision(0) == 1189591134u);
|
|
||||||
static_assert(rehash_for_collision(0xBA5EDB01) == 0u);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE(pair_int_hash)
|
TEST_CASE(pair_int_hash)
|
||||||
{
|
{
|
||||||
static_assert(pair_int_hash(42, 17) == 339337046u);
|
static_assert(pair_int_hash(42, 17) == 339337046u);
|
||||||
|
|
Loading…
Reference in a new issue