summaryrefslogtreecommitdiff
path: root/linkhash.h
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2012-03-31 17:33:58 -0500
committerEric Haszlakiewicz <erh+git@nimenees.com>2012-03-31 17:33:58 -0500
commit64c0ca3690f98e978fd2fc8c6ca645243c27e3db (patch)
tree17ea82874c4705ad3900c4f23b35df1691139f19 /linkhash.h
parentaef439a1750a69c4721df50b83d696218a60db49 (diff)
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.
Diffstat (limited to 'linkhash.h')
-rw-r--r--linkhash.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/linkhash.h b/linkhash.h
index 90f219d..9d89460 100644
--- a/linkhash.h
+++ b/linkhash.h
@@ -22,6 +22,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
*/
#define LH_EMPTY (void*)-1