summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2013-04-27 09:33:51 +0200
committerAndrea Canciani <ranma42@gmail.com>2013-04-27 09:37:14 +0200
commit091c786e856efc89beb6bc7506d9fd58465ab7b7 (patch)
tree851ad8a9aadfb1a5360821c74b4372979285e763
parente14e825fb90bf2eeac1b1eaddccf8455c6fdc4ca (diff)
hashtable: Fix free slot threshold handling
Make threshold computation consistent with the comment. Fixes wrong behavior when num_slots < 8 (which resulted in 0 free slots).
-rw-r--r--hashtable.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/hashtable.h b/hashtable.h
index 7cfe9a4..8a4bedb 100644
--- a/hashtable.h
+++ b/hashtable.h
@@ -344,7 +344,7 @@ _simpledata_hashtable_size (size_t count, int shift)
size_t threshold; \
\
/* Guarantee at least 50% free slots */ \
- threshold = hashtable->num_slots / 8; \
+ threshold = hashtable->num_slots / 2; \
if (SIMPLEOPS_UNLIKELY (hashtable->free_slots < threshold)) \
_##prefix##_rehash (hashtable); \
\