From 3306bcb0e623ccd51f9f1049dba8e88c55e1db0d Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Mon, 11 Sep 2017 15:17:31 -0700 Subject: [PATCH] fix #820 : GCC v3.x 32-bits doesn't define 64-bits intrinsic resulting in undefined symbol error. Push the requirement to GCC 4 for now. Another solution, proposed by @NWilson, is to use __LONG_MAX__ instead. __LONG_MAX__ is a GCC-specific constant, which value is supposed to depend on underlying target hardware (32/64 bits) Might be better, but seems also more complex, hence more prone to side effects. Keeping the simple solution for now (just rely on __GNUC__) --- lib/compress/zstd_compress.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/compress/zstd_compress.h b/lib/compress/zstd_compress.h index 4da0317a7..d8813782c 100644 --- a/lib/compress/zstd_compress.h +++ b/lib/compress/zstd_compress.h @@ -168,7 +168,7 @@ static unsigned ZSTD_NbCommonBytes (register size_t val) unsigned long r = 0; _BitScanForward64( &r, (U64)val ); return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 3) +# elif defined(__GNUC__) && (__GNUC__ >= 4) return (__builtin_ctzll((U64)val) >> 3); # else static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, @@ -202,7 +202,7 @@ static unsigned ZSTD_NbCommonBytes (register size_t val) unsigned long r = 0; _BitScanReverse64( &r, val ); return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 3) +# elif defined(__GNUC__) && (__GNUC__ >= 4) return (__builtin_clzll(val) >> 3); # else unsigned r; -- 2.47.2