diff options
author | Yann Collet <cyan@fb.com> | 2017-11-03 17:30:52 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2017-11-03 17:30:52 (GMT) |
commit | c9bbad53ffda4a4f4595e3a2b6e3994710ee2324 (patch) | |
tree | faf163794a307b0d66585d072f3ced76dcb533f4 /lib/lz4hc.c | |
parent | e2eca62046e500a95ab34e913e939aa68acb2cd4 (diff) | |
download | lz4-c9bbad53ffda4a4f4595e3a2b6e3994710ee2324.zip lz4-c9bbad53ffda4a4f4595e3a2b6e3994710ee2324.tar.gz lz4-c9bbad53ffda4a4f4595e3a2b6e3994710ee2324.tar.bz2 |
removed ctx->searchNum
nbSearches now transmitted directly as function parameter
easier to track and debug
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r-- | lib/lz4hc.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c index 643fbb2..a7577c5 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -640,17 +640,6 @@ _dest_overflow: return 0; } -static int LZ4HC_getSearchNum(int compressionLevel) -{ - assert(compressionLevel >= 1); - assert(compressionLevel <= LZ4HC_CLEVEL_MAX); - switch (compressionLevel) { - default: return 1 << (compressionLevel-1); - case 10: return 1 << 12; - case 11: return 512; - case 12: return 1<<13; - } -} static int LZ4HC_compress_generic ( LZ4HC_CCtx_internal* const ctx, @@ -667,16 +656,14 @@ static int LZ4HC_compress_generic ( if (limit == limitedDestSize) cLevel = 10; switch (cLevel) { case 10: - return LZ4HC_compress_hashChain(ctx, src, dst, srcSizePtr, dstCapacity, 1 << 12, limit); + return LZ4HC_compress_hashChain(ctx, src, dst, srcSizePtr, dstCapacity, 1<<12, limit); case 11: - ctx->searchNum = LZ4HC_getSearchNum(cLevel); - return LZ4HC_compress_optimal(ctx, src, dst, *srcSizePtr, dstCapacity, limit, 128, 0); + return LZ4HC_compress_optimal(ctx, src, dst, *srcSizePtr, dstCapacity, limit, 512, 128, 0); default: cLevel = 12; /* fall-through */ case 12: - ctx->searchNum = LZ4HC_getSearchNum(cLevel); - return LZ4HC_compress_optimal(ctx, src, dst, *srcSizePtr, dstCapacity, limit, LZ4_OPT_NUM, 1); + return LZ4HC_compress_optimal(ctx, src, dst, *srcSizePtr, dstCapacity, limit, 1<<13, LZ4_OPT_NUM, 1); } } return LZ4HC_compress_hashChain(ctx, src, dst, srcSizePtr, dstCapacity, 1 << (cLevel-1), limit); /* levels 1-9 */ @@ -741,7 +728,6 @@ void LZ4_resetStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel) LZ4_streamHCPtr->internal_donotuse.base = NULL; if (compressionLevel > LZ4HC_CLEVEL_MAX) compressionLevel = LZ4HC_CLEVEL_MAX; /* cap compression level */ LZ4_streamHCPtr->internal_donotuse.compressionLevel = compressionLevel; - LZ4_streamHCPtr->internal_donotuse.searchNum = LZ4HC_getSearchNum(compressionLevel); } void LZ4_setCompressionLevel(LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel) |