From 73171f50684a6f436d1ae4cbeb62a9af81a25cd9 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Wed, 24 Apr 2019 17:20:56 -0300 Subject: [PATCH] Removing unnecessary modulo in hashtable functions --- src/hashmap.h | 2 +- src/hashset.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hashmap.h b/src/hashmap.h index a1af6cb..1ab2c5d 100644 --- a/src/hashmap.h +++ b/src/hashmap.h @@ -539,7 +539,7 @@ static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531, size_t hash = _map_->hash(key); \ size_t pos = hash % _map_->capacity; \ \ - SNAME##_entry *target = &(_map_->buffer[pos % _map_->capacity]); \ + SNAME##_entry *target = &(_map_->buffer[pos]); \ \ while (target->state == ES_FILLED || target->state == ES_DELETED) \ { \ diff --git a/src/hashset.h b/src/hashset.h index c817834..65809cd 100644 --- a/src/hashset.h +++ b/src/hashset.h @@ -618,7 +618,7 @@ static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531, size_t hash = _set_->hash(element); \ size_t pos = hash % _set_->capacity; \ \ - SNAME##_entry *target = &(_set_->buffer[pos % _set_->capacity]); \ + SNAME##_entry *target = &(_set_->buffer[pos]); \ \ while (target->state == ES_FILLED || target->state == ES_DELETED) \ { \