From 5dc7e334b241726dc72bebe693e6fe0a77c914b2 Mon Sep 17 00:00:00 2001 From: hkc Date: Mon, 22 Apr 2024 15:25:43 +0300 Subject: [PATCH] Wrong miss calculation on sfx_pool_grow --- src/sfxd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sfxd.c b/src/sfxd.c index 73334a8..1dcee01 100644 --- a/src/sfxd.c +++ b/src/sfxd.c @@ -378,13 +378,13 @@ void sfx_pool_grow(int size) { uint32_t new_hash = adler32(sounds_pool.sounds[i].key, strlen(sounds_pool.sounds[i].key)); for (int offset = 0; offset < size; offset++) { int index = (new_hash + offset) % size; -#ifndef NO_COUNTERS - global_counters.pool_write++; - if (offset != 0) { - global_counters.hash_misses_write++; - } -#endif if (new_items[index].key[0] == '\0') { +#ifndef NO_COUNTERS + if (offset != 0) { + global_counters.hash_misses_write++; + } + global_counters.pool_write++; +#endif memcpy(&new_items[index], &sounds_pool.sounds[i], sizeof(struct sfx_pool_item)); used++; break;