Core: Add Ast_Label

This commit is contained in:
Krzosa Karol
2023-04-22 12:38:48 +02:00
parent d244608571
commit eff6b10cf4
10 changed files with 140 additions and 98 deletions

View File

@@ -289,14 +289,13 @@ hash_string(String string) {
return hash;
}
CORE_Static U64
force_inline U64
hash_u64(U64 x) {
x *= 0xff51afd7ed558ccd;
x ^= x >> 32;
return x;
U64 result = hash_string({(U8 *)&x, sizeof(x)});
return result;
}
CORE_Static U64
force_inline U64
hash_ptr(const void *ptr) {
return hash_u64((uintptr_t)ptr);
}
@@ -314,14 +313,14 @@ hash_mix(U64 x, U64 y) {
return x;
}
CORE_Static U64
force_inline U64
is_pow2(U64 x) {
assert(x != 0);
B32 result = (x & (x - 1llu)) == 0;
return result;
}
CORE_Static U64
force_inline U64
wrap_around_pow2(U64 x, U64 power_of_2) {
assert(is_pow2(power_of_2));
U64 r = (((x) & ((power_of_2)-1llu)));