char* const dest,
int const inputSize,
int const maxOutputSize,
- int compressionLevel,
+ unsigned maxNbAttempts,
limitedOutput_directive limit
)
{
BYTE* op = (BYTE*) dest;
BYTE* const oend = op + maxOutputSize;
- unsigned maxNbAttempts;
int ml, ml2, ml3, ml0;
const BYTE* ref = NULL;
const BYTE* start2 = NULL;
const BYTE* ref0;
/* init */
- maxNbAttempts = 1 << (compressionLevel-1);
ctx->end += inputSize;
ip++;
*/
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);
}
/* --- Useful constants --- */
#define LZ4HC_MIN_CLEVEL 3
#define LZ4HC_DEFAULT_CLEVEL 9
-#define LZ4HC_MAX_CLEVEL 20
+#define LZ4HC_MAX_CLEVEL 12
/*-************************************
#define LZ4HC_MAXD (1<<(LZ4HC_DICTIONARY_LOGSIZE+1))
#define LZ4HC_MAXD_MASK (LZ4HC_MAXD - 1)
-#define LZ4HC_HASH_LOG (LZ4HC_DICTIONARY_LOGSIZE-1)
+#define LZ4HC_HASH_LOG (LZ4HC_DICTIONARY_LOGSIZE+2)
#define LZ4HC_HASHTABLESIZE (1 << LZ4HC_HASH_LOG)
#define LZ4HC_HASH_MASK (LZ4HC_HASHTABLESIZE - 1)