| 25 pointers instead of actual items. |
25 pointers instead of actual items. |
| 26 |
26 |
| 27 If you pass zero for the number of `buckets`, |
27 If you pass zero for the number of `buckets`, |
| 28 the map is initialized with a default of 16 buckets; otherwise the specified number of buckets is allocated. |
28 the map is initialized with a default of 16 buckets; otherwise the specified number of buckets is allocated. |
| 29 |
29 |
| 30 The function `cxMapRehash()` allocates a new array of buckets and re-distributes all elements, |
30 The `cxMapRehash()` function creates a new bucket array and reassigns all elements when the element count surpasses three-quarters of the bucket count. |
| 31 if the number of elements exceeds ¾ of the number of buckets. |
31 If this condition isn't met, the function returns 0 without making any changes. |
| 32 Otherwise, no action is performed, and this function simply returns 0. |
32 Post-rehashing, the bucket count will be at least two and a half times the element count. |
| 33 After rehashing, the number of buckets is at least 2½ times the number of elements. |
|
| 34 |
33 |
| 35 > Advice if you want to create your own hash map structures: |
34 > Advice if you want to create your own hash map structures: |
| 36 > Calling `cxMapRehash()` on a map is only defined, when the map is based on the |
35 > Calling `cxMapRehash()` on a map is only defined when the map is based on the |
| 37 > `struct cx_hash_map_s` structure. |
36 > `struct cx_hash_map_s` structure. |
| 38 |
37 |
| 39 <seealso> |
38 <seealso> |
| 40 <category ref="apidoc"> |
39 <category ref="apidoc"> |
| 41 <a href="https://ucx.sourceforge.io/api/hash__map_8h.html">hash_map.h</a> |
40 <a href="https://ucx.sourceforge.io/api/hash__map_8h.html">hash_map.h</a> |