]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fix a C89 error in msvc
authorMa Lin <malincns@163.com>
Fri, 24 Sep 2021 00:57:16 +0000 (08:57 +0800)
committerMa Lin <malincns@163.com>
Sat, 25 Sep 2021 08:32:06 +0000 (16:32 +0800)
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

index ed50550f3f101fae5c5d6835ab3f9fb607470a42..fef28de8d81c2490396bad3f73d25ed4451f93f9 100644 (file)
@@ -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);