aboutsummaryrefslogtreecommitdiffstats
path: root/README
diff options
context:
space:
mode:
authorFabrice <fabrice@schaub-dev.xyz>2026-03-22 21:10:59 +0100
committerFabrice <fabrice@schaub-dev.xyz>2026-03-22 21:10:59 +0100
commit9b43c34b9b51d953bd4363df576a6f93e9596700 (patch)
treeb1bde5a42896cf526a9c05f71e1ee24ff41af964 /README
parentc37b906c3295c4bcece39e0ef49458472ff8c86f (diff)
implementing dempo
Diffstat (limited to 'README')
-rw-r--r--README42
1 files changed, 42 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..a00fff5
--- /dev/null
+++ b/README
@@ -0,0 +1,42 @@
+Cheesemap
+====
+
+Cheesemap is a swiss-table like HashMap implementation in C. It's designed to be fast but also easy to understand and improve.
+The HashMap might be a little memory efficient especially right after resizes and doesn't yet provide a shrink method. The HashMap
+is not yet production tested but fully working.
+
+* Example
+```
+#include "cheesemap.h"
+#include <stdint.h>
+#include <string.h>
+#include <stddef.h>
+
+struct user_info {
+ const char* country;
+ int age;
+ int zip;
+};
+
+uint64_t hash(const uint8_t* key) {
+ const char* name = (const char*)key;
+ uint64_t count;
+ while(*name) {
+ count++;
+ name++;
+ }
+
+ return count;
+}
+
+bool compare(const uint8_t* key1, const uint8_t* key2) {
+ const char* name1 = (const char*)key1;
+ const char* name2 = (const char*)key2;
+ return strcmp(name1, name2);
+}
+
+int main() {
+ struct cheesemap map;
+ cm_new(&map, sizeof(const char*), _Alignof(const char*), sizeof(struct user_info), _Alignof(struct user_info), NULL
+}
+```