mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
util: ilog2
This commit is contained in:
@@ -8,4 +8,8 @@ static inline long abs(long x) {
|
||||
return x < 0 ? -x : x;
|
||||
}
|
||||
|
||||
static inline long ilog2(long x) {
|
||||
return sizeof(long) * 8 - __builtin_clz(x) - 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user