diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-04-04 09:08:11 +0200 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-04-04 09:08:25 +0200 |
| commit | dd35a08384c0ab2408b39a933acbca535021ebe5 (patch) | |
| tree | 13e427f0b58af82670961ccb5765c4df8e7d642a /README.md | |
| parent | 034d140355fdc905ccb983f250a639bf96931951 (diff) | |
using improved integer types
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -15,7 +15,7 @@ is not yet production tested but fully working. #include "cheesemap.h" -_Noreturn void panic_impl(const char* file, uint32_t line, const char* fmt, +_Noreturn void panic_impl(const char* file, cm_u32 line, const char* fmt, ...) { fprintf(stderr, "Panic at %s:%u: ", file, line); va_list args; @@ -30,29 +30,29 @@ _Noreturn void panic_impl(const char* file, uint32_t line, const char* fmt, #define countof(arr) (sizeof(arr) / sizeof(*(arr))) // Simple hash function for string keys -uint64_t hash_string(const uint8_t* key, uint8_t* user) { +cm_u64 hash_string(const cm_u8* key, cm_u8* user) { (void)user; const char* str = *(const char**)key; - uint64_t hash = 5381; + cm_u64 hash = 5381; int c; while ((c = *str++)) hash = ((hash << 5) + hash) + c; // hash * 33 + c return hash; } // Compare function for string keys -bool compare_string(const uint8_t* key1, const uint8_t* key2, uint8_t* user) { +bool compare_string(const cm_u8* key1, const cm_u8* key2, cm_u8* user) { (void)user; return strcmp(*(const char**)key1, *(const char**)key2) == 0; } // Default allocator (uses malloc) -void* default_alloc(uintptr_t size, uint8_t* user) { +void* default_alloc(cm_usize size, cm_u8* user) { (void)user; return malloc(size); } // Default deallocator (uses free) -void default_dealloc(void* ptr, uint8_t* user) { +void default_dealloc(void* ptr, cm_u8* user) { (void)user; free(ptr); } @@ -108,4 +108,3 @@ int main(void) { Copyright © 2026 Fabrice ``` - |
