From: Yann Collet Date: Sun, 22 Nov 2015 01:42:28 +0000 (+0100) Subject: minor cr improvement X-Git-Tag: zstd-0.4.0^2~23^2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=007c1c6ff08acac83c7448175a45fe7f2093ded7;p=thirdparty%2Fzstd.git minor cr improvement --- diff --git a/lib/zstd_compress.c b/lib/zstd_compress.c index 7a63254de..0a4424434 100644 --- a/lib/zstd_compress.c +++ b/lib/zstd_compress.c @@ -1282,7 +1282,7 @@ FORCE_INLINE size_t ZSTD_HcFindBestMatch_selectMLS ( FORCE_INLINE size_t ZSTD_compressBlock_lazy_generic(ZSTD_CCtx* ctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize, - const U32 searchMethod, const U32 deep) /* 0 : hc; 1 : bt */ + const U32 searchMethod, const U32 depth) { seqStore_t* seqStorePtr = &(ctx->seqStore); const BYTE* const istart = (const BYTE*)src; @@ -1316,7 +1316,7 @@ size_t ZSTD_compressBlock_lazy_generic(ZSTD_CCtx* ctx, { /* repcode : we take it */ matchLength = ZSTD_count(ip+1+MINMATCH, ip+1+MINMATCH-offset_1, iend) + MINMATCH; - if (deep==0) goto _storeSequence; + if (depth==0) goto _storeSequence; } { @@ -1333,22 +1333,23 @@ size_t ZSTD_compressBlock_lazy_generic(ZSTD_CCtx* ctx, } /* let's try to find a better solution */ - while ((deep>=1) && (ip=1) + while (ip= MINMATCH) && (gain2 > gain1)) - matchLength = ml2, offset = 0, start = ip; + if ((mlRep >= MINMATCH) && (gain2 > gain1)) + matchLength = mlRep, offset = 0, start = ip; } { size_t offset2=999999; size_t ml2 = searchMax(ctx, ip, iend, &offset2, maxSearches, mls); - int gain2 = (int)(ml2*(3+deep) - ZSTD_highbit((U32)offset2+1)); /* raw approx */ - int gain1 = (int)(matchLength*(3+deep) - ZSTD_highbit((U32)offset+1) + (3+deep)); + int gain2 = (int)(ml2*4 - ZSTD_highbit((U32)offset2+1)); /* raw approx */ + int gain1 = (int)(matchLength*4 - ZSTD_highbit((U32)offset+1) + 4); if ((ml2 >= MINMATCH) && (gain2 > gain1)) { matchLength = ml2, offset = offset2, start = ip; @@ -1357,7 +1358,7 @@ size_t ZSTD_compressBlock_lazy_generic(ZSTD_CCtx* ctx, } /* let's find an even better one */ - if ((deep==2) && (ip