src/cx/hash_map.h

changeset 562
fd3368c20413
parent 559
8603709932b9
child 563
69a83fad8a35
     1.1 --- a/src/cx/hash_map.h	Fri May 27 14:14:55 2022 +0200
     1.2 +++ b/src/cx/hash_map.h	Fri May 27 17:40:27 2022 +0200
     1.3 @@ -108,41 +108,23 @@
     1.4  /**
     1.5   * Increases the number of buckets, if necessary.
     1.6   *
     1.7 - * The load value is \c loadFactor*buckets. If the element count exceeds the load
     1.8 - * value, the map needs to be rehashed. Otherwise, no action is performed and
     1.9 + * The load threshold is \c 0.75*buckets. If the element count exceeds the load
    1.10 + * threshold, the map will be rehashed. Otherwise, no action is performed and
    1.11   * this function simply returns 0.
    1.12   *
    1.13   * The rehashing process ensures, that the number of buckets is at least
    1.14 - * \p bucketFactor times the number of stored items. So there is enough room for additional
    1.15 + * 2.5 times the element count. So there is enough room for additional
    1.16   * elements without the need of another soon rehashing.
    1.17   *
    1.18 - * You can use this function after filling a map to dramatically increase access performance.
    1.19 + * You can use this function after filling a map to increase access performance.
    1.20   *
    1.21   * @note If the specified map is not a hash map, the behavior is undefined.
    1.22   *
    1.23   * @param map the map to rehash
    1.24 - * @param loadFactor a percentage threshold for the load of the map
    1.25 - * @param bucketFactor a factor for the number of buckets that shall be available after rehashing
    1.26   * @return zero on success, non-zero if a memory allocation error occurred
    1.27   */
    1.28  __attribute__((__nonnull__))
    1.29 -int cxMapRehash2(
    1.30 -        CxMap *map,
    1.31 -        float loadFactor,
    1.32 -        float bucketFactor
    1.33 -);
    1.34 -
    1.35 -/**
    1.36 - * Rehashes the map with load factor 0.75 and bucket factor 2.5.
    1.37 - *
    1.38 - * @param map the map to rehash
    1.39 - * @return zero on success, non-zero if a memory allocation error occurred
    1.40 - * @see cxMapRehash2()
    1.41 - */
    1.42 -__attribute__((__nonnull__))
    1.43 -static inline int cxMapRehash(CxMap *map) {
    1.44 -    return cxMapRehash2(map, 0.75f, 2.5f);
    1.45 -}
    1.46 +int cxMapRehash(CxMap *map);
    1.47  
    1.48  
    1.49  #ifdef __cplusplus

mercurial