fix naive version implementation

This commit is contained in:
escherstair 2020-08-04 14:39:19 +02:00
parent 91940e84b1
commit aa5dd60865

View File

@ -53,10 +53,10 @@ inline uint32_t clzll(uint64_t x) {
return static_cast<uint32_t>(__builtin_clzll(x)); return static_cast<uint32_t>(__builtin_clzll(x));
#else #else
// naive version // naive version
uint32_t r; uint32_t r = 63;
while (!(x & (static_cast<uint64_t>(1) << 63))) { while (!(x & (static_cast<uint64_t>(1) << 63))) {
x <<= 1; x <<= 1;
++r; --r;
} }
return r; return r;