diff options
Diffstat (limited to 'ht.h')
-rw-r--r-- | ht.h | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -1,22 +1,23 @@ #ifndef _ht_h #define _ht_h -#define HT_SIZE 128 +#include "val.h" typedef struct { - char *k; - int v; + ObjString *k; + Val v; } HtEntry; typedef struct { - int len; - HtEntry b[HT_SIZE]; + size_t len; + size_t cap; + HtEntry *b; } Ht; -typedef Ht Env; +uint32_t hash(char *s, size_t len); Ht ht_new(); -void ht_put(Ht *h, char *k, int v); -int ht_get(Ht *h, char *k, int *v); +void ht_put(Ht *h, ObjString *k, Val v); +Val ht_get(Ht *h, ObjString *k); #endif |