diff options
author | Przemyslaw Skibinski <inikep@gmail.com> | 2016-12-07 11:16:33 (GMT) |
---|---|---|
committer | Przemyslaw Skibinski <inikep@gmail.com> | 2016-12-07 11:16:33 (GMT) |
commit | e3fee94742f9027aa2d27fae6458ce285889552e (patch) | |
tree | 7f59213d2abcfa1f707c87f4dae48482a8702b04 /lib/lz4hc.c | |
parent | 757ef1d5fc710598c8a7325f9b227ccd96692187 (diff) | |
download | lz4-e3fee94742f9027aa2d27fae6458ce285889552e.zip lz4-e3fee94742f9027aa2d27fae6458ce285889552e.tar.gz lz4-e3fee94742f9027aa2d27fae6458ce285889552e.tar.bz2 |
LZ4HC_MAX_CLEVEL = 12
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r-- | lib/lz4hc.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c index 4381238..608dea9 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -313,7 +313,7 @@ static int LZ4HC_compress_hashChain ( char* const dest, int const inputSize, int const maxOutputSize, - int compressionLevel, + unsigned maxNbAttempts, limitedOutput_directive limit ) { @@ -326,7 +326,6 @@ static int LZ4HC_compress_hashChain ( BYTE* op = (BYTE*) dest; BYTE* const oend = op + maxOutputSize; - unsigned maxNbAttempts; int ml, ml2, ml3, ml0; const BYTE* ref = NULL; const BYTE* start2 = NULL; @@ -337,7 +336,6 @@ static int LZ4HC_compress_hashChain ( const BYTE* ref0; /* init */ - maxNbAttempts = 1 << (compressionLevel-1); ctx->end += inputSize; ip++; @@ -504,17 +502,15 @@ static int LZ4HC_compress_generic ( */ if (compressionLevel < 1) compressionLevel = LZ4HC_DEFAULT_CLEVEL; - if (compressionLevel > 16) { + if (compressionLevel > 9) { switch (compressionLevel) { - case 17: ctx->searchNum = 16; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, 16); - case 18: ctx->searchNum = 64; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, 64); - case 19: ctx->searchNum = 256; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, 256); + case 10: return LZ4HC_compress_hashChain(ctx, source, dest, inputSize, maxOutputSize, 1 << (16-1), limit); + case 11: ctx->searchNum = 256; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, 256); default: - case 20: ctx->searchNum = 1<<14; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, LZ4_OPT_NUM); + case 12: ctx->searchNum = 1<<14; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, LZ4_OPT_NUM); } } - - return LZ4HC_compress_hashChain(ctx, source, dest, inputSize, maxOutputSize, compressionLevel, limit); + return LZ4HC_compress_hashChain(ctx, source, dest, inputSize, maxOutputSize, 1 << (compressionLevel-1), limit); } |