diff options
Diffstat (limited to 'src/ht/ft_hthash.c')
| -rw-r--r-- | src/ht/ft_hthash.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ht/ft_hthash.c b/src/ht/ft_hthash.c index 66f8efb..e7e696c 100644 --- a/src/ht/ft_hthash.c +++ b/src/ht/ft_hthash.c @@ -10,6 +10,8 @@ /* */ /* ************************************************************************** */ +#include "libft_ht.h" + t_ftht_digest ft_hthash(t_ftht *ht, char *key) { t_ftht_digest digest; @@ -19,8 +21,8 @@ t_ftht_digest ft_hthash(t_ftht *ht, char *key) digest = *key++ << 7; while (*key != '\0') { - digest = ((1000003 * digest) ^ *key) & (1<<32); + digest = ((1000003 * digest) ^ *key) & (1 << 16); key++; } - return (digest); + return (digest % ht->size); } |
