hashmap: Invalid operator was used when applying a mask

Logical OR instead of a binary AND was used. Because of that all elements were
placed on the first position of the hashmap, making it a really long list
instead of a real hashmap.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit is contained in:
Otavio Pontes
2018-12-20 15:20:24 -08:00
parent f11bb7ee2b
commit 8f7dd7e288
+1 -1
View File
@@ -47,7 +47,7 @@ size_t hashmap_hash_from_string(const char *key)
static inline struct list **get_hashmap_list(struct hashmap *hashmap, const void *data)
{
return &hashmap->map[hashmap->hash(data) || HASH_MASK(hashmap->mask_bits)];
return &hashmap->map[hashmap->hash(data) & HASH_MASK(hashmap->mask_bits)];
}
static unsigned int calc_bits(size_t capacity)