]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
[zstd] Backport D49756856
authorNick Terrell <terrelln@meta.com>
Tue, 4 Mar 2025 19:55:39 +0000 (14:55 -0500)
committerNick Terrell <nickrterrell@gmail.com>
Wed, 5 Mar 2025 15:35:01 +0000 (10:35 -0500)
lib/decompress/zstd_decompress_block.c

index 3a8e634f9c1d23dbf95751014df4c15deaeeac10..6174a250bceb5ff6116a868df375b929a34dd0fd 100644 (file)
@@ -1726,7 +1726,7 @@ size_t ZSTD_prefetchMatch(size_t prefetchPos, seq_t const sequence,
         /* note : this operation can overflow when seq.offset is really too large, which can only happen when input is corrupted.
          * No consequence though : memory address is only used for prefetching, not for dereferencing */
         const BYTE* const match = (const BYTE*)ZSTD_wrappedPtrSub(ZSTD_wrappedPtrAdd(matchBase, (ptrdiff_t)prefetchPos), (ptrdiff_t)sequence.offset);
-        PREFETCH_L1(match); PREFETCH_L1(match+CACHELINE_SIZE);   /* note : it's safe to invoke PREFETCH() on any memory address, including invalid ones */
+        PREFETCH_L1(match); PREFETCH_L1(ZSTD_wrappedPtrAdd(match, CACHELINE_SIZE));   /* note : it's safe to invoke PREFETCH() on any memory address, including invalid ones */
     }
     return prefetchPos + sequence.matchLength;
 }