Respond to PR Comments; Formatting/Style/Lint Fixes

This commit is contained in:
W. Felix Handte 2018-05-09 13:14:20 -04:00
parent ca26cecc7a
commit ae4fcf7816
3 changed files with 12 additions and 5 deletions

View File

@ -2152,11 +2152,14 @@ ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_dictMo
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,

View File

@ -515,12 +515,16 @@ MEM_STATIC U32 ZSTD_window_hasExtDict(ZSTD_window_t const window)
/**
* 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;
}
/**

View File

@ -72,7 +72,7 @@ size_t ZSTD_compressBlock_fast_generic(
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 :