Wrong miss calculation on sfx_pool_grow
This commit is contained in:
parent
b68a4b7ccb
commit
5dc7e334b2
12
src/sfxd.c
12
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));
|
uint32_t new_hash = adler32(sounds_pool.sounds[i].key, strlen(sounds_pool.sounds[i].key));
|
||||||
for (int offset = 0; offset < size; offset++) {
|
for (int offset = 0; offset < size; offset++) {
|
||||||
int index = (new_hash + offset) % size;
|
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') {
|
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));
|
memcpy(&new_items[index], &sounds_pool.sounds[i], sizeof(struct sfx_pool_item));
|
||||||
used++;
|
used++;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue