diff options
author | Andrea Canciani <ranma42@gmail.com> | 2013-04-27 09:33:51 +0200 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2013-04-27 09:37:14 +0200 |
commit | 091c786e856efc89beb6bc7506d9fd58465ab7b7 (patch) | |
tree | 851ad8a9aadfb1a5360821c74b4372979285e763 | |
parent | e14e825fb90bf2eeac1b1eaddccf8455c6fdc4ca (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.h | 2 |
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); \ \ |