1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

fix calculation of log2i(1)

This commit is contained in:
Steffen Vogel 2016-11-07 22:15:00 -05:00
parent dd7e0443ce
commit 88e36f272b

View file

@ -221,7 +221,8 @@ __attribute__((always_inline)) static inline uint64_t rdtsc()
/** Get log2 of long long integers */
static inline int log2i(long long x) {
assert(x > 0);
if (x == 0)
return 1;
return sizeof(x) * 8 - __builtin_clzll(x) - 1;
}