ZSTD_compressBlock_fast_dictMatchState,
NULL, NULL, NULL, NULL, NULL, NULL, NULL /* unimplemented as of yet */ }
};
+ ZSTD_blockCompressor selectedCompressor;
ZSTD_STATIC_ASSERT((unsigned)ZSTD_fast == 1);
assert((U32)strat >= (U32)ZSTD_fast);
assert((U32)strat <= (U32)ZSTD_btultra);
- return blockCompressor[(int)dictMode][(U32)strat];
+ selectedCompressor = blockCompressor[(int)dictMode][(U32)strat];
+ assert(selectedCompressor != NULL);
+ return selectedCompressor;
}
static void ZSTD_storeLastLiterals(seqStore_t* seqStorePtr,
/**
* ZSTD_matchState_dictMode():
- * Does what the label says.
+ * Inspects the provided matchState and figures out what dictMode should be
+ * passed to the compressor.
*/
MEM_STATIC ZSTD_dictMode_e ZSTD_matchState_dictMode(const ZSTD_matchState_t *ms)
{
- return ms->dictMatchState != NULL ? ZSTD_dictMatchState :
- ZSTD_window_hasExtDict(ms->window) ? ZSTD_extDict : ZSTD_noDict;
+ return ms->dictMatchState != NULL ?
+ ZSTD_dictMatchState :
+ ZSTD_window_hasExtDict(ms->window) ?
+ ZSTD_extDict :
+ ZSTD_noDict;
}
/**
const BYTE* const dictEnd = hasDict == ZSTD_dictMatchState ?
dms->window.nextSrc : NULL;
const U32 dictIndexDelta = hasDict == ZSTD_dictMatchState ?
- localLowestIndex - (dictEnd - dictBase) :
+ localLowestIndex - (U32)(dictEnd - dictBase) :
0;
ptrdiff_t dictLowestLocalIndex = hasDict == ZSTD_dictMatchState ?
lowestDictIndex + dictIndexDelta :