forked from hkc/sfxd
1
0
Fork 0

Wrong miss calculation on sfx_pool_grow

This commit is contained in:
Casey 2024-04-22 15:25:43 +03:00
parent b68a4b7ccb
commit 5dc7e334b2
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 6 additions and 6 deletions

View File

@ -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;