Skip to content

Commit 7f559ec

Browse files
committed
fix naive implementation for clzll()
1 parent 58e2964 commit 7f559ec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/rapidjson/internal/clzll.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ inline uint32_t clzll(uint64_t x) {
5353
return static_cast<uint32_t>(__builtin_clzll(x));
5454
#else
5555
// naive version
56-
uint32_t r = 63;
56+
uint32_t r = 0;
5757
while (!(x & (static_cast<uint64_t>(1) << 63))) {
5858
x <<= 1;
59-
--r;
59+
++r;
6060
}
6161

6262
return r;

0 commit comments

Comments
 (0)