Removing unnecessary modulo in hashtable functions

This commit is contained in:
Leonardo committed 2019-04-24 17:20:56 -03:00
1 parent f07efbd828
commit 73171f5068
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -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) \
{ \
+1 -1
View File
@@ -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) \
{ \