mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-29 00:04:40 +00:00
Consensus: Fix bug when compiler do not support __builtin_clz*
#ifdef is not correct since defination is defined to 0 or 1. Should change to #if Github-Pull: #12573 Rebased-From: 18307849b405f9e2067eaa8091b105838f413707
This commit is contained in:
parent
b72c0bd4c9
commit
88d1a649a2
@ -82,12 +82,12 @@ void static inline WriteBE64(unsigned char* ptr, uint64_t x)
|
|||||||
/** Return the smallest number n such that (x >> n) == 0 (or 64 if the highest bit in x is set. */
|
/** Return the smallest number n such that (x >> n) == 0 (or 64 if the highest bit in x is set. */
|
||||||
uint64_t static inline CountBits(uint64_t x)
|
uint64_t static inline CountBits(uint64_t x)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DECL___BUILTIN_CLZL
|
#if HAVE_DECL___BUILTIN_CLZL
|
||||||
if (sizeof(unsigned long) >= sizeof(uint64_t)) {
|
if (sizeof(unsigned long) >= sizeof(uint64_t)) {
|
||||||
return x ? 8 * sizeof(unsigned long) - __builtin_clzl(x) : 0;
|
return x ? 8 * sizeof(unsigned long) - __builtin_clzl(x) : 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_DECL___BUILTIN_CLZLL
|
#if HAVE_DECL___BUILTIN_CLZLL
|
||||||
if (sizeof(unsigned long long) >= sizeof(uint64_t)) {
|
if (sizeof(unsigned long long) >= sizeof(uint64_t)) {
|
||||||
return x ? 8 * sizeof(unsigned long long) - __builtin_clzll(x) : 0;
|
return x ? 8 * sizeof(unsigned long long) - __builtin_clzll(x) : 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user