It's now possible to set the load factor at compile time using
the HASHMAP_LOAD_FACTOR define:
cc -DHASHMAP_LOAD_FACTOR=0.75 ...
or by using the hashmap_set_load_factor function
hashmap_set_load_factor(map, 0.75);
The load factor should be in the range of 50% to 95%.
The README previously advertised ANSI C support, and while C99 is technically an ANSI standard, ANSI C means C89, not C99, in basically every circumstance.
Changes:
- Added xxhash3 hasher function.
- Added _with_hash functions for manually providing a hash to the
get, set, and delete functions. This makes the hash callback
that is given to the hashmap_new function optional.
- Added set_grow_by_power which defines how quickly the hashmap
grows when needed. Default is 1, which mean it doubles each
time it needs to grow, setting to 2 or 3 will grow by 4 or 8
respectively. Max 16.
- Default grow_at percentange has been changed from 0.75 to 0.60.
- The hash field now clipped with bitwise AND instead of shifting.
- The compare function is now optional. When not provided, the
clipped (48-bit) hash becomes the key.
- Code cleanup
hashmap_clear quickly clears the map.
When the update_cap is provided, the map's capacity will be
updated to match the currently number of allocated buckets.
This is an optimization to ensure that this operation does
not perform any allocations.
closes#1