/*-*************************************
* Binary Tree search
***************************************/
-FORCE_INLINE /* inlining is important to hardwire a hot branch (template emulation) */
-U32 ZSTD_insertBtAndGetAllMatches (
+static U32 ZSTD_insertBtAndGetAllMatches (
ZSTD_CCtx* zc,
const BYTE* const ip, const BYTE* const iend,
U32 nbCompares, const U32 mls,
U32 dummy32; /* to be nullified at the end */
U32 mnum = 0;
- if (matchIndex >= current) return 0;
bestLength = MINMATCH-1;
hashTable[h] = current; /* Update Hash Table */
/** Tree updater, providing best match */
-FORCE_INLINE /* inlining is important to hardwire a hot branch (template emulation) */
-U32 ZSTD_BtGetAllMatches (
+static U32 ZSTD_BtGetAllMatches (
ZSTD_CCtx* zc,
const BYTE* const ip, const BYTE* const iLimit,
const U32 maxNbAttempts, const U32 mls, ZSTD_match_t* matches, U32 minml)
}
/** Tree updater, providing best match */
-FORCE_INLINE /* inlining is important to hardwire a hot branch (template emulation) */
-U32 ZSTD_BtGetAllMatches_extDict (
+static U32 ZSTD_BtGetAllMatches_extDict (
ZSTD_CCtx* zc,
const BYTE* const ip, const BYTE* const iLimit,
const U32 maxNbAttempts, const U32 mls, ZSTD_match_t* matches, U32 minml)
/* HC4 match finder */
matchIndex = ZSTD_insertAndFindFirstIndex (zc, ip, mls);
- if (matchIndex >= current) return 0;
while ((matchIndex>lowLimit) && (nbAttempts)) {
size_t currentMl=0;
ZSTD_updatePrice(seqStorePtr, 0, anchor, 0, best_mlen);
ZSTD_storeSeq(seqStorePtr, 0, anchor, 0, best_mlen);
anchor += best_mlen+MINMATCH;
- ip = anchor;
continue; /* faster when present ... (?) */
- } }
+ }
+ if (anchor > ip) ip = anchor;
+ }
{ /* Last Literals */
size_t lastLLSize = iend - anchor;
ZSTD_updatePrice(seqStorePtr, 0, anchor, 0, mlen-MINMATCH);
ZSTD_storeSeq(seqStorePtr, 0, anchor, 0, mlen-MINMATCH);
anchor += mlen;
- ip = anchor;
continue; /* faster when present ... (?) */
}
break;
- } }
+ }
+ if (anchor > ip) ip = anchor;
+ }
{ /* Last Literals */
size_t lastLLSize = iend - anchor;
/*********************************************************
* Fuzzer functions
*********************************************************/
+#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
static U32 FUZ_GetMilliStart(void)
crcOrig = XXH64(sampleBuffer, sampleSize, 0);
/* compression test */
- cLevelMod = MAX(1, 38 - (int)(MAX(9, sampleSizeLog) * 2)); /* high levels only for small samples, for manageable speed */
+ //cLevelMod = MAX(1, 38 - (int)(MAX(9, sampleSizeLog) * 2)); /* high levels only for small samples, for manageable speed */
+ cLevelMod = MIN( ZSTD_maxCLevel(), (U32)MAX(1, 55 - 3*(int)sampleSizeLog) ); /* high levels only for small samples, for manageable speed */
cLevel = (FUZ_rand(&lseed) % cLevelMod) +1;
cSize = ZSTD_compressCCtx(ctx, cBuffer, cBufferSize, sampleBuffer, sampleSize, cLevel);
CHECK(ZSTD_isError(cSize), "ZSTD_compressCCtx failed");