diff options
author | 532479301 <532479301@qq.com> | 2018-03-01 17:20:27 +0800 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-07-13 12:23:39 -0400 |
commit | 88d1a649a2e9cfa471fc00f8c853e53383eb4695 (patch) | |
tree | 714cbcb4831334b3a8498e4f3297038c1d8fdc4a | |
parent | b72c0bd4c9cf36163fdef6ce0c60970d112d1100 (diff) | |
download | bitcoin-88d1a649a2e9cfa471fc00f8c853e53383eb4695.tar.xz |
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
-rw-r--r-- | src/crypto/common.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/crypto/common.h b/src/crypto/common.h index 825b430978..6e9d6dc82a 100644 --- a/src/crypto/common.h +++ b/src/crypto/common.h @@ -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. */ 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)) { return x ? 8 * sizeof(unsigned long) - __builtin_clzl(x) : 0; } #endif -#ifdef HAVE_DECL___BUILTIN_CLZLL +#if HAVE_DECL___BUILTIN_CLZLL if (sizeof(unsigned long long) >= sizeof(uint64_t)) { return x ? 8 * sizeof(unsigned long long) - __builtin_clzll(x) : 0; } |