static size_t
identity_hash (int data)
{
- return data;
+ size_t hash;
+ int i;
+
+ hash = 0;
+ for (i = 0; i < 32; i++)
+ if (data & (1u << i))
+ {
+ size_t high_bit = (size_t) 1 << (sizeof (size_t) * CHAR_BIT - 1);
+ hash |= high_bit >> i;
+ }
+
+ return hash;
}
static size_t
int max = INT_MIN;
int j;
- for (j = 0; j <= hmap.mask; j++)
+ for (j = 0; j < hmap_n_buckets (&hmap); j++)
{
int count = 0;
struct hmap_node *node;