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:
parent
dd7e0443ce
commit
88e36f272b
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue