]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Add ZSTD_DECOMPRESS_MINIMAL Macro, Which Reduces Branching of Decompress Variants
authorW. Felix Handte <w@felixhandte.com>
Fri, 16 Nov 2018 23:02:11 +0000 (15:02 -0800)
committerW. Felix Handte <w@felixhandte.com>
Tue, 18 Dec 2018 21:36:39 +0000 (13:36 -0800)
lib/decompress/zstd_decompress_block.c

index 869bdd9aaa3f236a437ee0863483dc3cd231b055..00f04208b421542c25b1c258304ab9b13676b254 100644 (file)
@@ -1201,13 +1201,17 @@ ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,
     }
 
     /* Build Decoding Tables */
-    {   int usePrefetchDecoder = dctx->ddictIsCold;
+    {
+#ifndef ZSTD_DECOMPRESS_MINIMAL
+        int usePrefetchDecoder = dctx->ddictIsCold;
+#endif
         int nbSeq;
         size_t const seqHSize = ZSTD_decodeSeqHeaders(dctx, &nbSeq, ip, srcSize);
         if (ZSTD_isError(seqHSize)) return seqHSize;
         ip += seqHSize;
         srcSize -= seqHSize;
 
+#ifndef ZSTD_DECOMPRESS_MINIMAL
         if ( !usePrefetchDecoder
           && (!frame || (dctx->fParams.windowSize > (1<<24)))
           && (nbSeq>ADVANCED_SEQS) ) {  /* could probably use a larger nbSeq limit */
@@ -1215,11 +1219,14 @@ ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,
             U32 const minShare = MEM_64bits() ? 7 : 20; /* heuristic values, correspond to 2.73% and 7.81% */
             usePrefetchDecoder = (shareLongOffsets >= minShare);
         }
+#endif
 
         dctx->ddictIsCold = 0;
 
+#ifndef ZSTD_DECOMPRESS_MINIMAL
         if (usePrefetchDecoder)
             return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
+#endif
 
         /* else */
         return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);