1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#ifndef _ht_h #define _ht_h typedef struct _ht Ht; typedef struct _state State; #include "val.h" typedef struct { ObjString *k; Val v; } HtEntry; typedef struct _ht { size_t len; size_t cap; HtEntry *d; } Ht; uint32_t hash(char *s, size_t len); Ht ht_new(); void ht_put(State *S, Ht *h, ObjString *k, Val v); Val ht_get(State *S, Ht *h, ObjString *k); #endif