From a44692ef4c0ac49f4b6330a1f53a7f26fb38b864 Mon Sep 17 00:00:00 2001 From: onelin Date: Thu, 20 Mar 2025 20:46:52 +0100 Subject: Fix some warnings --- src/utils/include/engine/utils/hashmap.h | 6 +++--- src/utils/include/engine/utils/stack.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/utils/include/engine') diff --git a/src/utils/include/engine/utils/hashmap.h b/src/utils/include/engine/utils/hashmap.h index d8fdbf2..0113ce5 100644 --- a/src/utils/include/engine/utils/hashmap.h +++ b/src/utils/include/engine/utils/hashmap.h @@ -11,7 +11,7 @@ extern "C" { #include #include -i32 lolhash(const usize s, i32 v); +usize lolhash(const usize s, usize v); /* Define a linked list before using this */ /* Example: DEFINE_LLIST(i32) */ @@ -23,7 +23,7 @@ i32 lolhash(const usize s, i32 v); } hashmap_##type; \ \ type* hashmap_##type##_lookup(hashmap_##type* hmap, const type* val) { \ - const i32 idx = lolhash(64, type_to_int(val)); \ + const usize idx = lolhash(64, type_to_int(val)); \ List_##type* head = &hmap->elems[idx]; \ while (head != NULL) { \ if (!cmp(&(head->value), val)) return &(head->value); \ @@ -34,7 +34,7 @@ i32 lolhash(const usize s, i32 v); \ void hashmap_##type##_insert(memory* m, hashmap_##type* hmap, \ const type* val) { \ - const i32 idx = lolhash(64, type_to_int(val)); \ + const usize idx = lolhash(64, type_to_int(val)); \ List_##type* head = &(hmap->elems[idx]); \ \ /* This is highly dependant on whether the memory is zero-initialized */ \ diff --git a/src/utils/include/engine/utils/stack.h b/src/utils/include/engine/utils/stack.h index b8e1807..b4caf5f 100644 --- a/src/utils/include/engine/utils/stack.h +++ b/src/utils/include/engine/utils/stack.h @@ -8,7 +8,7 @@ extern "C" { #include typedef struct { - isize head; /* current number of elements */ + usize head; /* current number of elements */ const usize elem_size; /* size in bytes of each element */ usize size; /* current memory size used by the stack */ const usize chunk_size; /* size of which the stack increases when running out @@ -24,7 +24,7 @@ void stack_free(Stack* s); void* stack_pop(Stack* s); void stack_push(Stack* s, void* elem); void* stack_peek(Stack* s); -isize stack_size(const Stack* s); +usize stack_size(const Stack* s); void stack_swap(Stack* s, Stack* t); #ifdef __cplusplus -- cgit v1.3