]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fix rsyncable mode 2611/head
authorYann Collet <cyan@fb.com>
Tue, 4 May 2021 22:59:27 +0000 (15:59 -0700)
committerYann Collet <cyan@fb.com>
Tue, 4 May 2021 22:59:27 +0000 (15:59 -0700)
lib/compress/zstdmt_compress.c

index 5f822da44ac96082016ff6804f24611028c032cc..cfd75cc4932cd3083fce9e9853481ec91909673d 100644 (file)
@@ -1240,9 +1240,8 @@ size_t ZSTDMT_initCStream_internal(
 
     if (params.rsyncable) {
         /* Aim for the targetsectionSize as the average job size. */
-        U32 const jobSizeMB = (U32)(mtctx->targetSectionSize >> 20);
-        U32 const rsyncBits = ZSTD_highbit32(jobSizeMB) + 20;
-        assert(jobSizeMB >= 1);
+        U32 const jobSizeKB = (U32)(mtctx->targetSectionSize >> 10);
+        U32 const rsyncBits = (assert(jobSizeKB >= 1), ZSTD_highbit32(jobSizeKB) + 10);
         DEBUGLOG(4, "rsyncLog = %u", rsyncBits);
         mtctx->rsync.hash = 0;
         mtctx->rsync.hitMask = (1ULL << rsyncBits) - 1;