From 8f7dd7e288dc22cf9184c6ea8a794ba7e77f6f35 Mon Sep 17 00:00:00 2001 From: Otavio Pontes Date: Mon, 17 Dec 2018 23:00:07 +0000 Subject: [PATCH] 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 --- src/lib/hashmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/hashmap.c b/src/lib/hashmap.c index 6091e5a1..fd68cdbc 100644 --- a/src/lib/hashmap.c +++ b/src/lib/hashmap.c @@ -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)