From c83618999227adb5e745f92205bd48e076e2d124 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sat, 29 Jul 2023 22:22:23 +0100 Subject: th --- ht.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 ht.h (limited to 'ht.h') diff --git a/ht.h b/ht.h new file mode 100644 index 0000000..5aaffe7 --- /dev/null +++ b/ht.h @@ -0,0 +1,22 @@ +#ifndef _ht_h +#define _ht_h + +#define HT_SIZE 128 + +typedef struct { + char *k; + int v; +} HtEntry; + +typedef struct { + int len; + HtEntry b[HT_SIZE]; +} Ht; + +typedef Ht Env; + +Ht ht_new(); +void ht_put(Ht *h, char *k, int v); +int ht_get(Ht *h, char *k, int *v); + +#endif -- cgit v1.2.3