diff --git a/hash_table.h b/hash_table.h index 559dd39..072fcf6 100644 --- a/hash_table.h +++ b/hash_table.h @@ -394,9 +394,10 @@ static void PREFIX(_remove)(PREFIX(_table) *table, void *key) uint32_t hash = MAP_TABLE_HASH_KEY(key); PREFIX(_table_cell) baseCell = PREFIX(_table_lookup)(table, hash); - if (baseCell && baseCell < cell && cell - baseCell <= 32) + if (baseCell && baseCell != cell) { - uint32_t jump = 1 << (cell - baseCell - 1); + uint32_t displacement = (cell - baseCell + table->table_size) % table->table_size; + uint32_t jump = 1 << (displacement - 1); if ((baseCell->secondMaps & jump)) { // If we are removing a cell stored adjacent to its base due to hash