From db147ea620151f30b6825ad7c2fb29161cade94d Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Tue, 6 Mar 2018 18:15:26 -0800 Subject: [PATCH] improved comments following @terrelln suggestions --- lib/decompress/zstd_decompress.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index 53f55533..8aa21db7 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -1279,6 +1279,10 @@ static size_t ZSTD_decompressSequencesLong(ZSTD_DCtx* dctx, return ZSTD_decompressSequencesLong_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); } +/* ZSTD_getLongOffsetsShare() : + * condition : offTable must be valid + * @return : "share" of long offsets (arbitrarily defined as > (1<<23)) + * compared to maximum possible of (1<fParams.windowSize > (1<<24) || !frame) + if ( (!frame || dctx->fParams.windowSize > (1<<24)) && (nbSeq>0) ) { /* could probably use a larger nbSeq limit */ U32 const shareLongOffsets = ZSTD_getLongOffsetsShare(dctx->OFTptr); - U32 const minShare = MEM_64bits() ? 7 : 20; + U32 const minShare = MEM_64bits() ? 7 : 20; /* heuristic values, correspond to 2.73% and 7.81% */ if (shareLongOffsets >= minShare) return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset); }