From: Nick Terrell Date: Wed, 13 Dec 2017 18:55:24 +0000 (-0800) Subject: [fileio] Fix window size MB calculation X-Git-Tag: v1.3.3^2~13^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F948%2Fhead;p=thirdparty%2Fzstd.git [fileio] Fix window size MB calculation Test command: ``` head -c 10000 /dev/zero | ./zstd -c --zstd=wlog=12 | ./zstd -M2048 -t ``` --- diff --git a/programs/fileio.c b/programs/fileio.c index 101c99b1a..4758fa0ed 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -1149,7 +1149,7 @@ static void FIO_zstdErrorHelp(dRess_t* ress, size_t ret, char const* srcFileName if (ret == 0) { U32 const windowSize = (U32)header.windowSize; U32 const windowLog = BIT_highbit32(windowSize) + ((windowSize & (windowSize - 1)) != 0); - U32 const windowMB = (windowSize >> 20) + (windowSize & ((1 MB) - 1)); + U32 const windowMB = (windowSize >> 20) + ((windowSize & ((1 MB) - 1)) != 0); assert(header.windowSize <= (U64)((U32)-1)); assert(g_memLimit > 0); DISPLAYLEVEL(1, "%s : Window size larger than maximum : %llu > %u\n",