Rehashes the table so that expected_count entries (or the current count, if larger) fit within the load factor.
Use it before a bulk add when the final size is known, or after many removals to rebuild a table that has
filled up with removed markers. It never loses entries, and invalidates pointers into the table. A negative
expected_count fails an assert.
table: Table(int, int);
table_resize(*table, 1000);
slots := table.allocated;
for 0..999 table_add(*table, it, it);
assert(table.allocated == slots && table.count == 1000); // no growth in between
deinit(*table);table_resize :: (table: *Table, expected_count: s64)
Rehashes the table so that expected_count entries (or the current count, if larger) fit within the load factor.
Use it before a bulk add when the final size is known, or after many removals to rebuild a table that has
filled up with removed markers. It never loses entries, and invalidates pointers into the table. A negative
expected_count fails an assert.
Parameters
- table: *Table
- expected_count: s64
table: Table(int, int);
table_resize(*table, 1000);
slots := table.allocated;
for 0..999 table_add(*table, it, it);
assert(table.allocated == slots && table.count == 1000); // no growth in between
deinit(*table);