summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/map.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/map.h b/include/map.h
new file mode 100644
index 0000000..1dea3e7
--- /dev/null
+++ b/include/map.h
@@ -0,0 +1,31 @@
+#ifndef _MYMAP_H
+#define _MYMAP_H
+
+#include <string.h>
+#include <stdint.h>
+
+#define A
+
+typedef struct Node{
+ char *key;
+ char *value;
+ struct Node *next;
+}node;
+
+typedef struct Map{
+ uint32_t size;
+ node **head;
+}string_map;
+
+string_map init_map(uint32_t size);
+/*
+ * 64-bit FNV-1 hash
+ * https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
+ */
+#define FNV_offset_basis 14695981039346656037UL
+#define FNV_prime 1099511628211UL
+uint32_t hash_function(char *key, uint32_t size);
+void insert_map(char *key, char *value, string_map map);
+node *create_node(char *key, char *value);
+char *get_value(char *key, string_map map);
+#endif