From 89fe36162221ab36c5f2dfec1446dc406c68272b Mon Sep 17 00:00:00 2001 From: Johnny Richard Date: Wed, 17 May 2023 18:06:12 +0200 Subject: util: Create hashmap data structure with FNV-1a 32-bit hashing This path implements a hashmap data structure using the FNV-1a hashing function of 32 bits. However, there are a few limitations to consider: a) The table does not automatically expand when it becomes too large. b) The capacity of the hashmap must be a power of 2 to optimize performance, as we utilize bitwise shifting instead of modulus calculations. c) Currently, there are no functions available to destroy hashmap entries. Collisions are handled using a linked list, which is not the most optimal solution in terms of performance. However, it serves our current needs adequately. Signed-off-by: Johnny Richard --- test/Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/Makefile') diff --git a/test/Makefile b/test/Makefile index 6bdec12..88a8481 100644 --- a/test/Makefile +++ b/test/Makefile @@ -31,6 +31,9 @@ vector_test: munit.o ../build/vector.o vector_test.o list_test: munit.o ../build/list.o list_test.o $(CC) $? $(CFLAGS) -o $@ +hashmap_test: munit.o ../build/hashmap.o hashmap_test.o + $(CC) $? $(CFLAGS) -o $@ + lexer_test: munit.o ../build/string_view.o ../build/lexer.o lexer_test.o $(CC) $? $(CFLAGS) -o $@ -- cgit v1.2.3