Encoder: modernize builtin clz guard

This commit is contained in:
Eugene Kliuchnikov 2017-01-26 13:25:44 +01:00
parent 8d3fdc1dfe
commit afa2e74fe2
2 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@ extern "C" {
#endif
static BROTLI_INLINE uint32_t Log2FloorNonZero(size_t n) {
#ifdef __GNUC__
#if BROTLI_MODERN_COMPILER || __has_builtin(__builtin_clz)
return 31u ^ (uint32_t)__builtin_clz((uint32_t)n);
#else
uint32_t result = 0;

View File

@ -36,7 +36,7 @@
#if defined(BROTLI_BUILD_MODERN_COMPILER)
#define BROTLI_MODERN_COMPILER 1
#elif BROTLI_GCC_VERSION > 300 || BROTLI_ICC_VERSION >= 1600
#elif BROTLI_GCC_VERSION >= 304 || BROTLI_ICC_VERSION >= 1600
#define BROTLI_MODERN_COMPILER 1
#else
#define BROTLI_MODERN_COMPILER 0