Add shortcut for unsigned_x/power_of_two -> unsigned_x >> log2(power_of_two)

This commit is contained in:
gingerBill
2025-08-10 17:53:07 +01:00
parent da76c743e9
commit 4cbcb3ace7
2 changed files with 18 additions and 0 deletions

View File

@@ -80,6 +80,13 @@ gb_internal gb_inline bool is_power_of_two(i64 x) {
return !(x & (x-1));
}
gb_internal gb_inline bool is_power_of_two_u64(u64 x) {
if (x == 0) {
return false;
}
return !(x & (x-1));
}
gb_internal int isize_cmp(isize x, isize y) {
if (x < y) {
return -1;