mirror of
https://github.com/facebook/zstd.git
synced 2025-12-08 00:03:24 -05:00
Add ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG
This macro forces behavior in the opposite direction.
This commit is contained in:
parent
64553a0e35
commit
4bbb8a48ad
@ -27,6 +27,18 @@
|
|||||||
#include "zstd_ddict.h" /* ZSTD_DDictDictContent */
|
#include "zstd_ddict.h" /* ZSTD_DDictDictContent */
|
||||||
#include "zstd_decompress_block.h"
|
#include "zstd_decompress_block.h"
|
||||||
|
|
||||||
|
/*_*******************************************************
|
||||||
|
* Macros
|
||||||
|
**********************************************************/
|
||||||
|
|
||||||
|
/* These two optional macros force the use one way or another of the two
|
||||||
|
* ZSTD_decompressSequences implementations. You can't force in both directions
|
||||||
|
* at the same time.
|
||||||
|
*/
|
||||||
|
#if defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
|
||||||
|
defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
|
||||||
|
#error "Cannot force the use of the short and the long ZSTD_decompressSequences variants!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*_*******************************************************
|
/*_*******************************************************
|
||||||
@ -1202,7 +1214,12 @@ ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,
|
|||||||
|
|
||||||
/* Build Decoding Tables */
|
/* Build Decoding Tables */
|
||||||
{
|
{
|
||||||
#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
|
/* These macros control at build-time which decompressor implementation
|
||||||
|
* we use. If neither is defined, we do some inspection and dispatch at
|
||||||
|
* runtime.
|
||||||
|
*/
|
||||||
|
#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
|
||||||
|
!defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
|
||||||
int usePrefetchDecoder = dctx->ddictIsCold;
|
int usePrefetchDecoder = dctx->ddictIsCold;
|
||||||
#endif
|
#endif
|
||||||
int nbSeq;
|
int nbSeq;
|
||||||
@ -1211,7 +1228,8 @@ ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,
|
|||||||
ip += seqHSize;
|
ip += seqHSize;
|
||||||
srcSize -= seqHSize;
|
srcSize -= seqHSize;
|
||||||
|
|
||||||
#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
|
#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
|
||||||
|
!defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
|
||||||
if ( !usePrefetchDecoder
|
if ( !usePrefetchDecoder
|
||||||
&& (!frame || (dctx->fParams.windowSize > (1<<24)))
|
&& (!frame || (dctx->fParams.windowSize > (1<<24)))
|
||||||
&& (nbSeq>ADVANCED_SEQS) ) { /* could probably use a larger nbSeq limit */
|
&& (nbSeq>ADVANCED_SEQS) ) { /* could probably use a larger nbSeq limit */
|
||||||
@ -1223,13 +1241,18 @@ ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,
|
|||||||
|
|
||||||
dctx->ddictIsCold = 0;
|
dctx->ddictIsCold = 0;
|
||||||
|
|
||||||
#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
|
#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
|
||||||
|
!defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
|
||||||
if (usePrefetchDecoder)
|
if (usePrefetchDecoder)
|
||||||
|
#endif
|
||||||
|
#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
|
||||||
return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
|
return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG
|
||||||
/* else */
|
/* else */
|
||||||
return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
|
return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user