Fix another bug in the hash table.

Clearing the secondMaps was incorrect for cases where the secondMaps
included a wrap around to the start of the table.
main
David Chisnall 8 years ago
parent 00c631c58e
commit a8e5f6ced0

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

Loading…
Cancel
Save