static void LZ4HC_setExternalDict(LZ4HC_CCtx_internal* ctxPtr, const BYTE* newBlock)
{
- if (ctxPtr->end >= ctxPtr->base + 4) LZ4HC_Insert (ctxPtr, ctxPtr->end-3); /* Referencing remaining dictionary content */
- LZ4HC_updateBinTree(ctxPtr, ctxPtr->end - MFLIMIT, ctxPtr->end - LASTLITERALS);
+ if (ctxPtr->compressionLevel >= LZ4HC_MIN_CLEVEL_OPT)
+ LZ4HC_updateBinTree(ctxPtr, ctxPtr->end - MFLIMIT, ctxPtr->end - LASTLITERALS);
+ else
+ if (ctxPtr->end >= ctxPtr->base + 4) LZ4HC_Insert (ctxPtr, ctxPtr->end-3); /* Referencing remaining dictionary content */
/* Only one memory segment for extDict, so any previous extDict is lost at this stage */
ctxPtr->lowLimit = ctxPtr->dictLimit;
/* --- Useful constants --- */
#define LZ4HC_MIN_CLEVEL 3
#define LZ4HC_DEFAULT_CLEVEL 9
+#define LZ4HC_MIN_CLEVEL_OPT 11
#define LZ4HC_MAX_CLEVEL 12
#define LZ4_LOG_PARSER(fmt, ...) //printf(fmt, __VA_ARGS__)
#define LZ4_LOG_PRICE(fmt, ...) //printf(fmt, __VA_ARGS__)
#define LZ4_LOG_ENCODE(fmt, ...) //printf(fmt, __VA_ARGS__)
-#include <stdio.h>
+
#define LZ4_OPT_NUM (1<<12)
if (ip < ctx->base + ctx->nextToUpdateBT) return 0; /* skipped area */
if (fullUpdate) LZ4HC_updateBinTree(ctx, ip, iHighLimit);
best_mlen = LZ4HC_BinTree_InsertAndGetAllMatches(ctx, ip, iHighLimit, best_mlen, matches, &mnum);
- ctx->nextToUpdateBT = (U32)(ip - ctx->base) + best_mlen;
+ ctx->nextToUpdateBT = (U32)(ip - ctx->base + best_mlen);
return mnum;
}