From 6a564da0f9c510c0222b05ba5da18c6ef73e8030 Mon Sep 17 00:00:00 2001
From: leo <leo@azuminha.com>
Date: Wed, 3 Apr 2024 15:16:39 -0300
Subject: map implementado

---
 include/map.h | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 include/map.h

(limited to 'include')

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
-- 
cgit v1.2.3