zephr/ui: introduce IDs to ui elements to track the active element

This commit is contained in:
2024-01-08 05:55:58 +02:00
parent 56a6ace875
commit 0b89bf2390
6 changed files with 212 additions and 130 deletions
+30
View File
@@ -31,3 +31,33 @@ _Noreturn uintptr_t _core_abort(const char* file, int line, const char* message,
/* fprintf(stderr, "stacktrace:\n%s\n\n", stacktrace); */
abort();
}
///////////////////////////
//
//
// Hash
//
//
///////////////////////////
u32 core_fnv_hash32(const void* bytes, uptr size, u32 hash) {
const u8* b = bytes;
for (uptr idx = 0; idx < size; idx++) {
hash ^= b[idx];
hash *= CORE_FNV_HASH32_PRIME;
}
return hash;
}
u64 core_fnv_hash64(const void* bytes, uptr size, u64 hash) {
const u8* b = bytes;
for(uptr idx = 0; idx < size; idx++) {
hash ^= b[idx];
hash *= CORE_FNV_HASH64_PRIME;
}
return hash;
}