mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 23:18:21 +00:00
util: fix log2
This commit is contained in:
@@ -8,8 +8,8 @@ static inline long abs(long x) {
|
|||||||
return x < 0 ? -x : x;
|
return x < 0 ? -x : x;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline long ilog2(long x) {
|
static inline unsigned long log2(unsigned long x) {
|
||||||
return sizeof(long) * 8 - __builtin_clz(x) - 1;
|
return sizeof(unsigned long) * 8 - __builtin_clzll(x) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline long min(long x, long y) {
|
static inline long min(long x, long y) {
|
||||||
|
|||||||
Reference in New Issue
Block a user