]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fix #820 : GCC v3.x 32-bits doesn't define 64-bits intrinsic 837/head
authorYann Collet <cyan@fb.com>
Mon, 11 Sep 2017 22:17:31 +0000 (15:17 -0700)
committerYann Collet <cyan@fb.com>
Mon, 11 Sep 2017 22:17:31 +0000 (15:17 -0700)
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

index 4da0317a7e313ef931407aa99e0310d91adcdc6d..d8813782cd6859fcda1f8c12715fa8bcff738447 100644 (file)
@@ -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;