mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-14 07:13:14 +00:00
Add shortcut for unsigned_x/power_of_two -> unsigned_x >> log2(power_of_two)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user