{
uptrval startingOffset = hc4->end - hc4->base;
DEBUGLOG(4, "LZ4HC_init(%p, %p)", hc4, start);
- if (startingOffset > 1 GB || startingOffset > (uptrval)start) {
+ if (startingOffset > 1 GB) {
LZ4HC_clearTables(hc4);
startingOffset = 0;
}
static void LZ4HC_setExternalDict(LZ4HC_CCtx_internal* ctxPtr, const BYTE* newBlock)
{
DEBUGLOG(4, "LZ4HC_setExternalDict(%p, %p)", ctxPtr, newBlock);
- if (ctxPtr->end >= ctxPtr->base + 4) LZ4HC_Insert (ctxPtr, ctxPtr->end-3); /* Referencing remaining dictionary content */
+ if (ctxPtr->end - ctxPtr->base - ctxPtr->nextToUpdate >= 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;