Rehashes every entry into a new array of new_allocated slots, and frees the old one.
The size is rounded up to a power of two and never below the minimum of 32 slots, nor below what the current entries need
at the load factor. A negative new_allocated (the default) doubles the slots. Removed entries are dropped by the
rehash, so it also reclaims the space they filled. Every pointer into the table is stale afterwards. Adds call this for
you; reach for table_resize to plan ahead.
table: Table(int, int);
table_add(*table, 1, 10);
before := table.allocated;
expand(*table);
assert(table.allocated > before && table.count == 1);
deinit(*table);expand :: (table: *Table, new_allocated := -1)
Parameters
- table: *Table
- new_allocated := -1