forked from hkc/sfxd
1
0
Fork 0

Also use exponential probing during lookups

This commit is contained in:
Vftdan 2024-02-25 15:37:11 +01:00
parent c5035fba81
commit c3af4ce4be
1 changed files with 1 additions and 2 deletions

View File

@ -388,8 +388,7 @@ void sfx_pool_grow(int size) {
struct sfx_pool_item *sfx_pool_lookup(const char *key) {
if (key == NULL) return NULL;
uint32_t hash = adler32(key, strlen(key));
for (int offset = 0; offset < sounds_pool.cap; offset++) {
int index = (hash + offset) % sounds_pool.cap;
FOR_OFFSET_PROBE (hash, offset, index, sounds_pool.cap) {
if (0 == strncmp(key, sounds_pool.sounds[index].key, KEY_LENGTH)) {
#ifndef NO_COUNTERS
global_counters.pool_read++;