Hash_Table module

expand

procedure · 1 overloadSource

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.

expand :: (table: *Table, new_allocated := -1)

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.

Parameters

table: *Table
new_allocated := -1

See also