From c449025e52393fcd9a5ccbace5fd015d41a345c5 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Sat, 6 Apr 2019 23:55:05 -0300 Subject: [PATCH] Minor fix in hashset --- src/hashset.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hashset.h b/src/hashset.h index c75c75c..05f3a7c 100644 --- a/src/hashset.h +++ b/src/hashset.h @@ -190,7 +190,7 @@ static const size_t cmc_hashtable_primes[] = {53, 97, 193, 389, 769, 1543, 3079, if (target->state == ES_EMPTY || target->state == ES_DELETED) \ { \ target->value = element; \ - target->dist = original_pos - pos; \ + target->dist = pos - original_pos; \ target->state = ES_FILLED; \ } \ else \ @@ -207,7 +207,7 @@ static const size_t cmc_hashtable_primes[] = {53, 97, 193, 389, 769, 1543, 3079, target->state = ES_FILLED; \ break; \ } \ - else if (target->dist < original_pos - pos) \ + else if (target->dist < pos - original_pos) \ { \ V tmp = target->value; \ size_t tmp_dist = target->dist; \