From 112d0bbb8ee74deeef7192a816edba056e49600d Mon Sep 17 00:00:00 2001 From: Patrick Cleavelin Date: Fri, 15 Mar 2024 16:09:24 -0500 Subject: [PATCH] hash table impl --- src/ht.h | 22 ++++++++++++++++++++++ src/ui.h | 4 ++++ 2 files changed, 26 insertions(+) create mode 100644 src/ht.h diff --git a/src/ht.h b/src/ht.h new file mode 100644 index 0000000..5017615 --- /dev/null +++ b/src/ht.h @@ -0,0 +1,22 @@ +// A simple/fast(?) hash table. + +#ifndef ED_HT_INCLUDED +#define ED_HT_INCLUDED +#include +#include +#include "string.h" + +// see +#define FNV_OFFSET 14695981039346656037UL +#define FNV_PRIME 1099511628211UL + +typedef struct { + +} ed_ht_slot; + +typedef struct { + ed_ht_slot *slots; + size_t capacity; +} ed_ht; + +#endif diff --git a/src/ui.h b/src/ui.h index fd01b17..8749b3f 100644 --- a/src/ui.h +++ b/src/ui.h @@ -71,6 +71,10 @@ typedef struct { size_t parent; } ui_element_frame_data; +typedef struct { + ed_ht *cached_elements; +} ui_context; + #endif #ifdef ED_UI_IMPLEMENTATION