From cc22042da0819b37cf69175bd92fe26a2975eea7 Mon Sep 17 00:00:00 2001 From: Ma Lin Date: Fri, 24 Sep 2021 08:57:16 +0800 Subject: [PATCH] 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. --- lib/compress/zstd_lazy.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); -- 2.47.2