U32 offset;
hashTable[h] = current; /* update hash table */
- if ( ((repIndex <= dictLimit-4) || (repIndex >= dictLimit))
+ if ( ((repIndex >= dictLimit) || (repIndex <= dictLimit-4))
&& (MEM_read32(repMatch) == MEM_read32(ip+1)) ) {
const BYTE* repMatchEnd = repIndex < dictLimit ? dictEnd : iend;
mlCode = ZSTD_count_2segments(ip+1+MINMATCH, repMatch+MINMATCH, iend, repMatchEnd, lowPrefixPtr);
offset = 0;
} else {
if ( (matchIndex < lowLimit) ||
- (MEM_read32(match) != MEM_read32(ip)) )
- { ip += ((ip-anchor) >> g_searchStrength) + 1; continue; }
- {
- const BYTE* matchEnd = matchIndex < dictLimit ? dictEnd : iend;
+ (MEM_read32(match) != MEM_read32(ip)) ) {
+ ip += ((ip-anchor) >> g_searchStrength) + 1;
+ continue;
+ }
+ { const BYTE* matchEnd = matchIndex < dictLimit ? dictEnd : iend;
const BYTE* lowMatchPtr = matchIndex < dictLimit ? dictStart : lowPrefixPtr;
mlCode = ZSTD_count_2segments(ip+MINMATCH, match+MINMATCH, iend, matchEnd, lowPrefixPtr);
while ((ip>anchor) && (match>lowMatchPtr) && (ip[-1] == match[-1])) { ip--; match--; mlCode++; } /* catch up */
idx += ZSTD_insertBt1(zc, base+idx, mls, iend, nbCompares, 0);
}
-/** Tree updater, providing best match */
+/** ZSTD_BtFindBestMatch() : Tree updater, providing best match */
static size_t ZSTD_BtFindBestMatch (
ZSTD_CCtx* zc,
const BYTE* const ip, const BYTE* const iLimit,
U32 idx = zc->nextToUpdate;
while(idx < target) {
- size_t h = ZSTD_hashPtr(base+idx, hashLog, mls);
+ size_t const h = ZSTD_hashPtr(base+idx, hashLog, mls);
NEXT_IN_CHAIN(idx, chainMask) = hashTable[h];
hashTable[h] = idx;
idx++;
/* HC4 match finder */
matchIndex = ZSTD_insertAndFindFirstIndex (zc, ip, mls);
- while ((matchIndex>lowLimit) && (nbAttempts)) {
+ for ( ; (matchIndex>lowLimit) && (nbAttempts) ; nbAttempts--) {
size_t currentMl=0;
- nbAttempts--;
if ((!extDict) || matchIndex >= dictLimit) {
match = base + matchIndex;
if (match[ml] == ip[ml]) /* potentially better */
/* store sequence */
_storeSequence:
- {
- size_t litLength = start - anchor;
+ { size_t const litLength = start - anchor;
ZSTD_storeSeq(seqStorePtr, litLength, anchor, offset, matchLength-MINMATCH);
anchor = ip = start + matchLength;
}
} }
/* Last Literals */
- {
- size_t lastLLSize = iend - anchor;
+ { size_t const lastLLSize = iend - anchor;
memcpy(seqStorePtr->lit, anchor, lastLLSize);
seqStorePtr->lit += lastLLSize;
}