Improved decompression speed (by @inikep)

dev
Yann Collet 2016-03-17 12:11:16 +01:00
parent fbc40b82d7
commit b40287aaef
1 changed files with 2 additions and 6 deletions

View File

@ -654,16 +654,12 @@ typedef struct {
static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState, const U32 mls) static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState, const U32 mls)
{ {
size_t litLength;
size_t prevOffset;
size_t offset;
size_t matchLength;
const BYTE* dumps = seqState->dumps; const BYTE* dumps = seqState->dumps;
const BYTE* const de = seqState->dumpsEnd; const BYTE* const de = seqState->dumpsEnd;
size_t litLength, offset, matchLength;
/* Literal length */ /* Literal length */
litLength = FSE_peakSymbol(&(seqState->stateLL)); litLength = FSE_peakSymbol(&(seqState->stateLL));
prevOffset = litLength ? seq->offset : seqState->prevOffset;
if (litLength == MaxLL) { if (litLength == MaxLL) {
U32 add = *dumps++; U32 add = *dumps++;
if (add < 255) litLength += add; if (add < 255) litLength += add;
@ -686,7 +682,7 @@ static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState, const U32 mls)
if (offsetCode==0) nbBits = 0; /* cmove */ if (offsetCode==0) nbBits = 0; /* cmove */
offset = offsetPrefix[offsetCode] + BIT_readBits(&(seqState->DStream), nbBits); offset = offsetPrefix[offsetCode] + BIT_readBits(&(seqState->DStream), nbBits);
if (MEM_32bits()) BIT_reloadDStream(&(seqState->DStream)); if (MEM_32bits()) BIT_reloadDStream(&(seqState->DStream));
if (offsetCode==0) offset = prevOffset; /* repcode, cmove */ if (offsetCode==0) offset = litLength ? seq->offset : seqState->prevOffset;
if (offsetCode | !litLength) seqState->prevOffset = seq->offset; /* cmove */ if (offsetCode | !litLength) seqState->prevOffset = seq->offset; /* cmove */
FSE_decodeSymbol(&(seqState->stateOffb), &(seqState->DStream)); /* update */ FSE_decodeSymbol(&(seqState->stateOffb), &(seqState->DStream)); /* update */
} }