const BYTE* repMatchEnd = repIndex < dictLimit ? dictEnd : iend;
mlCode = ZSTD_count_2segments(ip+1+MINMATCH, repMatch+MINMATCH, iend, repMatchEnd, lowPrefixPtr);
ip++;
- ZSTD_storeSeq(seqStorePtr, ip-anchor, anchor, offset, mlCode);
+ ZSTD_storeSeq(seqStorePtr, ip-anchor, anchor, 0, mlCode);
} else {
if ( (matchIndex < lowLimit) ||
(MEM_read32(match) != MEM_read32(ip)) )
searchMax_f searchMax = searchMethod ? ZSTD_BtFindBestMatch_selectMLS : ZSTD_HcFindBestMatch_selectMLS;
/* init */
- U32 rep[ZSTD_REP_NUM];
- for (int i=0; i<ZSTD_REP_NUM; i++)
+ U32 rep[ZSTD_REP_NUM+1];
+ for (int i=0; i<ZSTD_REP_NUM+1; i++)
rep[i]=REPCODE_STARTVALUE;
ZSTD_resetSeqStore(seqStorePtr);
if (depth==0) goto _storeSequence;
} else {
size_t mlRep = ZSTD_count(ip+1+MINMATCH, ip+1+MINMATCH-rep[i], iend) + MINMATCH;
- int gain2 = (int)(mlRep * 3 - (i+1));
- int gain1 = (int)(matchLength*3 - (offset+1) + 1);
+ int gain2 = (int)(mlRep * 3 /*- ZSTD_highbit((U32)i+1)*/);
+ int gain1 = (int)(matchLength*3 - /*ZSTD_highbit((U32)offset+1)*/ + 1);
if (gain2 > gain1)
matchLength = mlRep, offset = i;
}
/* store sequence */
_storeSequence:
{
+#if ZSTD_REP_NUM == 4
if (offset >= ZSTD_REP_NUM) {
rep[3] = rep[2];
rep[2] = rep[1];
rep[0] = temp;
}
}
+#else
+ if (offset >= ZSTD_REP_NUM) {
+ rep[1] = rep[0]; rep[0] = offset - (ZSTD_REP_NUM - 1);
+ }
+#endif
size_t litLength = start - anchor;
ZSTD_storeSeq(seqStorePtr, litLength, anchor, offset, matchLength-MINMATCH);
anchor = ip = start + matchLength;
/* Literal length */
litLength = FSE_peakSymbol(&(seqState->stateLL));
+#if 0 //ZSTD_REP_NUM == 1
+ size_t prevOffset = litLength ? seq->offset : seqState->prevOffset[0];
+#endif
if (litLength == MaxLL) {
U32 add = *dumps++;
if (add < 255) litLength += add;
if (offsetCode==0) nbBits = 0; /* cmove */
offset = offsetPrefix[offsetCode] + BIT_readBits(&(seqState->DStream), nbBits);
if (MEM_32bits()) BIT_reloadDStream(&(seqState->DStream));
+#if ZSTD_REP_NUM == 4
if (offsetCode==0) {
if (!litLength) {
offset = seqState->prevOffset[1];
seqState->prevOffset[2] = seqState->prevOffset[1];
seqState->prevOffset[1] = seq->offset; /* cmove */
}
- }
+ }
+#else
+#if 0
+ if (offsetCode==0) offset = prevOffset; /* repcode, cmove */
+ if (offsetCode | !litLength) seqState->prevOffset[0] = seq->offset; /* cmove */
+#else
+ if (offsetCode==0) offset = litLength ? seq->offset : seqState->prevOffset[0]; /* repcode, cmove */
+ if (offsetCode | !litLength) seqState->prevOffset[0] = seq->offset; /* cmove */
+#endif
+#endif
FSE_decodeSymbol(&(seqState->stateOffb), &(seqState->DStream)); /* update */
// printf("offsetCode=%d nbBits=%d offset=%d\n", offsetCode, nbBits, (int)offset); fflush(stdout);
}
U32 cur, match_num, last_pos, litlen, price;
/* init */
- U32 rep[ZSTD_REP_NUM];
- for (int i=0; i<ZSTD_REP_NUM; i++)
+ U32 rep[ZSTD_REP_NUM+1];
+ for (int i=0; i<ZSTD_REP_NUM+1; i++)
rep[i]=REPCODE_STARTVALUE;
ctx->nextToUpdate3 = ctx->nextToUpdate;
U32 cur, match_num, last_pos, litlen, price;
/* init */
- U32 rep[ZSTD_REP_NUM];
- for (int i=0; i<ZSTD_REP_NUM; i++)
+ U32 rep[ZSTD_REP_NUM+1];
+ for (int i=0; i<ZSTD_REP_NUM+1; i++)
rep[i]=REPCODE_STARTVALUE;
ctx->nextToUpdate3 = ctx->nextToUpdate;
} } }
/* warmimg up memory */
- int timeloop = additionalParam; //2500;
+ int timeloop = additionalParam ? additionalParam : 2500;
ZSTD_setAdditionalParam(refCtx, additionalParam);
RDG_genBuffer(compressedBuffer, maxCompressedSize, 0.10, 0.50, 1);