Define a LH_LOAD_FACTOR constant and note the range that it can be set to.

Change the resize check from "count > size" to "count >= size" to avoid a
potential infinite loop with high load factors and a full hash table.
This commit is contained in:
Eric Haszlakiewicz
2012-03-31 17:33:58 -05:00
parent aef439a175
commit 64c0ca3690
2 changed files with 8 additions and 1 deletions

View File

@@ -21,6 +21,13 @@ extern "C" {
*/
#define LH_PRIME 0x9e370001UL
/**
* The fraction of filled hash buckets until an insert will cause the table
* to be resized.
* This can range from just above 0 up to 1.0.
*/
#define LH_LOAD_FACTOR 0.66
/**
* sentinel pointer value for empty slots
*/