summaryrefslogtreecommitdiff
path: root/trans
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-05-13 18:59:10 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-05-13 21:38:35 +0200
commite2be8995642cd962b7d61c9c231980de88302d50 (patch)
treef3bea78d2b650340d15ffe4d8a90159c2e866a74 /trans
parent57341e5be12f79ee1916369679bb6507a10fcac9 (diff)
libihash: use fast binary scaling to determine the load
Expressing the maximum load in binary percent (where 128b% corresponds to 100%) allows us to use fast binary scaling to determine if the maximum load has been reached without losing precision. Furthermore, the previously used expression 'ht->nr_items * 100' overflows int at 2^25 (unsigned int at 2^26). When a hash table reached that limit, it would fail to resize and fill up the table. This change fixes that. * libihash/ihash.c (hurd_ihash_set_max_load): Update the comment. (hurd_ihash_add): Use fast binary scaling to determine the current load. * libihash/ihash.h (struct hurd_ihash): Update comment for max_load. (hurd_ihash_set_max_load): Update the comment.
Diffstat (limited to 'trans')
0 files changed, 0 insertions, 0 deletions