mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 03:08:05 +02:00
util/hash_table: replace fnv1a hash function with xxhash
xxhash is faster than fnv1a in almost all circumstances, so we're switching to it globally. Signed-off-by: Dmytro Nester <dmytro.nester@globallogic.com> Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4020>
This commit is contained in:
parent
013df58498
commit
387176829b
1 changed files with 7 additions and 7 deletions
|
|
@ -597,14 +597,14 @@ _mesa_hash_u32(const void *key)
|
|||
uint32_t
|
||||
_mesa_hash_string(const void *_key)
|
||||
{
|
||||
uint32_t hash = _mesa_fnv32_1a_offset_bias;
|
||||
uint32_t hash = 0;
|
||||
const char *key = _key;
|
||||
|
||||
while (*key != 0) {
|
||||
hash = _mesa_fnv32_1a_accumulate(hash, *key);
|
||||
key++;
|
||||
}
|
||||
|
||||
size_t len = strlen(key);
|
||||
#if defined(_WIN64) || defined(__x86_64__)
|
||||
hash = (uint32_t)XXH64(key, len, hash);
|
||||
#else
|
||||
hash = XXH32(key, len, hash);
|
||||
#endif
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue