From: root Date: Thu, 11 Dec 2014 13:30:51 +0000 (+0100) Subject: Fix compilation of match.c on big-endian machines, and avoid X-Git-Tag: 1.9.9-b1~885 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a9b6fba095a783cabd7ea14ed7af4d8e85a77bd;p=thirdparty%2Fzlib-ng.git Fix compilation of match.c on big-endian machines, and avoid usage of unoptimized builtins. --- diff --git a/match.c b/match.c index 5198c85b4..541f77c4f 100644 --- a/match.c +++ b/match.c @@ -9,19 +9,23 @@ */ #include - #include "deflate.h" #if (defined(UNALIGNED_OK) && MAX_MATCH == 258) -# if defined(HAVE_BUILTIN_CTZL) + + /* Only use std3_longest_match for little_endian systems, also avoid using it with + non-gcc compilers since the __builtin_ctzl() function might not be optimized. */ +# if defined(__GNUC__) && defined(HAVE_BUILTIN_CTZL) && ((__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || defined(__LITTLE_ENDIAN__)) # define std3_longest_match # else # define std2_longest_match # endif + #else # define std1_longest_match #endif + #ifdef std1_longest_match /*