Closed ctbtol84 closed 6 years ago
The current implementation is correct because m
is always power-of-2. Your change is also correct, but will waste one 4-bit integer, probably with mmap allocation.
Hi, attractivechaos. You can also remove the branching and shorten the code by calculating the flagset size with (((m)+15)/16) (or >>4 instead of /16 if you prefer the >> form).
In the version "0.2.8" of khash you have changed the method used to calculate the size of the flags array (__ac_fsize). This change results in Keys being overwritten or not stored correctly. In my project, I changed the '__ac_fsize' function as following:
define __ac_fsize(m) (((m)>>4) + 1)
The following implementation:
define __ac_fsize(m) ((m) < 16? 1 : (m)>>4)
does not ensure that the size of flags > n_buckets, right?
Thanks in advance, TB