diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-01-30 20:57:29 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-01-30 20:57:29 +0100 |
| commit | 3b884e3836c70b1a19eb7778308fadbc608b0384 (patch) | |
| tree | e57b327c39e4c16fbd8ad1b1a1511f143df71cdd /src/ht/ft_hthash.c | |
| parent | 6500b1ca9ce911d3db7c94ee3f4ee38489b8861a (diff) | |
| download | libft-3b884e3836c70b1a19eb7778308fadbc608b0384.tar.gz libft-3b884e3836c70b1a19eb7778308fadbc608b0384.tar.bz2 libft-3b884e3836c70b1a19eb7778308fadbc608b0384.zip | |
making hashtable compile
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); } |
