From: Ma Lin Date: Fri, 24 Sep 2021 00:57:16 +0000 (+0800) Subject: Fix a C89 error in msvc X-Git-Tag: v1.5.1~1^2~76^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc22042da0819b37cf69175bd92fe26a2975eea7;p=thirdparty%2Fzstd.git Fix a C89 error in msvc Variables (r) must be declared at the beginning of a code block. This causes msvc2012 to fail to compile 64-bit build. --- diff --git a/lib/compress/zstd_lazy.c b/lib/compress/zstd_lazy.c index ed50550f3..fef28de8d 100644 --- a/lib/compress/zstd_lazy.c +++ b/lib/compress/zstd_lazy.c @@ -881,8 +881,11 @@ typedef U64 ZSTD_VecMask; /* Clarifies when we are interacting with a U64 repr static U32 ZSTD_VecMask_next(ZSTD_VecMask val) { assert(val != 0); # if defined(_MSC_VER) && defined(_WIN64) - unsigned long r=0; - return _BitScanForward64(&r, val) ? (U32)r : 0; /* _BitScanForward64 not defined outside of x86/64 */ + { + unsigned long r = 0; + /* _BitScanForward64 is not defined outside of x64 */ + return _BitScanForward64(&r, val) ? (U32)r : 0; + } # elif (defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4)))) if (sizeof(size_t) == 4) { U32 mostSignificantWord = (U32)(val >> 32);