Lines Matching +full:1 +full:ms
20 ZSTD_updateDUBT(ZSTD_matchState_t* ms, in ZSTD_updateDUBT() argument
24 const ZSTD_compressionParameters* const cParams = &ms->cParams; in ZSTD_updateDUBT()
25 U32* const hashTable = ms->hashTable; in ZSTD_updateDUBT()
28 U32* const bt = ms->chainTable; in ZSTD_updateDUBT()
29 U32 const btLog = cParams->chainLog - 1; in ZSTD_updateDUBT()
30 U32 const btMask = (1 << btLog) - 1; in ZSTD_updateDUBT()
32 const BYTE* const base = ms->window.base; in ZSTD_updateDUBT()
34 U32 idx = ms->nextToUpdate; in ZSTD_updateDUBT()
38 idx, target, ms->window.dictLimit); in ZSTD_updateDUBT()
42 assert(idx >= ms->window.dictLimit); /* condition for valid base+idx */ in ZSTD_updateDUBT()
48 U32* const sortMarkPtr = nextCandidatePtr + 1; in ZSTD_updateDUBT()
55 ms->nextToUpdate = target; in ZSTD_updateDUBT()
64 ZSTD_insertDUBT1(ZSTD_matchState_t* ms, in ZSTD_insertDUBT1() argument
69 const ZSTD_compressionParameters* const cParams = &ms->cParams; in ZSTD_insertDUBT1()
70 U32* const bt = ms->chainTable; in ZSTD_insertDUBT1()
71 U32 const btLog = cParams->chainLog - 1; in ZSTD_insertDUBT1()
72 U32 const btMask = (1 << btLog) - 1; in ZSTD_insertDUBT1()
74 const BYTE* const base = ms->window.base; in ZSTD_insertDUBT1()
75 const BYTE* const dictBase = ms->window.dictBase; in ZSTD_insertDUBT1()
76 const U32 dictLimit = ms->window.dictLimit; in ZSTD_insertDUBT1()
83 U32* largerPtr = smallerPtr + 1; in ZSTD_insertDUBT1()
86 U32 const windowValid = ms->window.lowLimit; in ZSTD_insertDUBT1()
87 U32 const maxDistance = 1U << cParams->windowLog; in ZSTD_insertDUBT1()
101 * but it's still possible to have nextPtr[1] == ZSTD_DUBT_UNSORTED_MARK in ZSTD_insertDUBT1()
134 matchIndex, btLow, nextPtr[1]); in ZSTD_insertDUBT1()
135 …smallerPtr = nextPtr+1; /* new "candidate" => larger than match, which was smaller t… in ZSTD_insertDUBT1()
136 …matchIndex = nextPtr[1]; /* new matchIndex, larger than previous and closer to curren… in ZSTD_insertDUBT1()
154 ZSTD_matchState_t* ms, in ZSTD_DUBT_findBetterDictMatch() argument
162 const ZSTD_matchState_t * const dms = ms->dictMatchState; in ZSTD_DUBT_findBetterDictMatch()
169 const BYTE* const base = ms->window.base; in ZSTD_DUBT_findBetterDictMatch()
170 const BYTE* const prefixStart = base + ms->window.dictLimit; in ZSTD_DUBT_findBetterDictMatch()
176 U32 const dictIndexDelta = ms->window.lowLimit - dictHighLimit; in ZSTD_DUBT_findBetterDictMatch()
179 U32 const btLog = dmsCParams->chainLog - 1; in ZSTD_DUBT_findBetterDictMatch()
180 U32 const btMask = (1 << btLog) - 1; in ZSTD_DUBT_findBetterDictMatch()
198 …ngth-bestLength)) > (int)(ZSTD_highbit32(curr-matchIndex+1) - ZSTD_highbit32((U32)offsetPtr[0]+1))… in ZSTD_DUBT_findBetterDictMatch()
211 …dictMatchIndex = nextPtr[1]; /* new matchIndex larger than previous (closer to curren… in ZSTD_DUBT_findBetterDictMatch()
231 ZSTD_DUBT_findBestMatch(ZSTD_matchState_t* ms, in ZSTD_DUBT_findBestMatch() argument
237 const ZSTD_compressionParameters* const cParams = &ms->cParams; in ZSTD_DUBT_findBestMatch()
238 U32* const hashTable = ms->hashTable; in ZSTD_DUBT_findBestMatch()
243 const BYTE* const base = ms->window.base; in ZSTD_DUBT_findBestMatch()
245 U32 const windowLow = ZSTD_getLowestMatchIndex(ms, curr, cParams->windowLog); in ZSTD_DUBT_findBestMatch()
247 U32* const bt = ms->chainTable; in ZSTD_DUBT_findBestMatch()
248 U32 const btLog = cParams->chainLog - 1; in ZSTD_DUBT_findBestMatch()
249 U32 const btMask = (1 << btLog) - 1; in ZSTD_DUBT_findBestMatch()
254 U32* unsortedMark = bt + 2*(matchIndex&btMask) + 1; in ZSTD_DUBT_findBestMatch()
255 U32 nbCompares = 1U << cParams->searchLog; in ZSTD_DUBT_findBestMatch()
266 && (nbCandidates > 1) ) { in ZSTD_DUBT_findBestMatch()
273 unsortedMark = bt + 2*(matchIndex&btMask) + 1; in ZSTD_DUBT_findBestMatch()
289 U32* const nextCandidateIdxPtr = bt + 2*(matchIndex&btMask) + 1; in ZSTD_DUBT_findBestMatch()
291 ZSTD_insertDUBT1(ms, matchIndex, iend, in ZSTD_DUBT_findBestMatch()
299 const BYTE* const dictBase = ms->window.dictBase; in ZSTD_DUBT_findBestMatch()
300 const U32 dictLimit = ms->window.dictLimit; in ZSTD_DUBT_findBestMatch()
304 U32* largerPtr = bt + 2*(curr&btMask) + 1; in ZSTD_DUBT_findBestMatch()
305 U32 matchEndIdx = curr + 8 + 1; in ZSTD_DUBT_findBestMatch()
330 …ngth-bestLength)) > (int)(ZSTD_highbit32(curr-matchIndex+1) - ZSTD_highbit32((U32)offsetPtr[0]+1))… in ZSTD_DUBT_findBestMatch()
347 smallerPtr = nextPtr+1; /* new "smaller" => larger of match */ in ZSTD_DUBT_findBestMatch()
348 …matchIndex = nextPtr[1]; /* new matchIndex larger than previous (closer to current) */ in ZSTD_DUBT_findBestMatch()
360 assert(nbCompares <= (1U << ZSTD_SEARCHLOG_MAX)); /* Check we haven't underflowed. */ in ZSTD_DUBT_findBestMatch()
363 ms, ip, iend, in ZSTD_DUBT_findBestMatch()
369 ms->nextToUpdate = matchEndIdx - 8; /* skip repetitive patterns */ in ZSTD_DUBT_findBestMatch()
382 ZSTD_BtFindBestMatch( ZSTD_matchState_t* ms, in ZSTD_BtFindBestMatch() argument
389 if (ip < ms->window.base + ms->nextToUpdate) return 0; /* skipped area */ in ZSTD_BtFindBestMatch()
390 ZSTD_updateDUBT(ms, ip, iLimit, mls); in ZSTD_BtFindBestMatch()
391 return ZSTD_DUBT_findBestMatch(ms, ip, iLimit, offsetPtr, mls, dictMode); in ZSTD_BtFindBestMatch()
396 ZSTD_BtFindBestMatch_selectMLS ( ZSTD_matchState_t* ms, in ZSTD_BtFindBestMatch_selectMLS() argument
400 switch(ms->cParams.minMatch) in ZSTD_BtFindBestMatch_selectMLS()
403 case 4 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 4, ZSTD_noDict); in ZSTD_BtFindBestMatch_selectMLS()
404 case 5 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 5, ZSTD_noDict); in ZSTD_BtFindBestMatch_selectMLS()
406 case 6 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 6, ZSTD_noDict); in ZSTD_BtFindBestMatch_selectMLS()
412 ZSTD_matchState_t* ms, in ZSTD_BtFindBestMatch_dictMatchState_selectMLS() argument
416 switch(ms->cParams.minMatch) in ZSTD_BtFindBestMatch_dictMatchState_selectMLS()
419 case 4 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 4, ZSTD_dictMatchState); in ZSTD_BtFindBestMatch_dictMatchState_selectMLS()
420 case 5 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 5, ZSTD_dictMatchState); in ZSTD_BtFindBestMatch_dictMatchState_selectMLS()
422 case 6 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 6, ZSTD_dictMatchState); in ZSTD_BtFindBestMatch_dictMatchState_selectMLS()
428 ZSTD_matchState_t* ms, in ZSTD_BtFindBestMatch_extDict_selectMLS() argument
432 switch(ms->cParams.minMatch) in ZSTD_BtFindBestMatch_extDict_selectMLS()
435 case 4 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 4, ZSTD_extDict); in ZSTD_BtFindBestMatch_extDict_selectMLS()
436 case 5 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 5, ZSTD_extDict); in ZSTD_BtFindBestMatch_extDict_selectMLS()
438 case 6 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 6, ZSTD_extDict); in ZSTD_BtFindBestMatch_extDict_selectMLS()
452 ZSTD_matchState_t* ms, in ZSTD_insertAndFindFirstIndex_internal() argument
456 U32* const hashTable = ms->hashTable; in ZSTD_insertAndFindFirstIndex_internal()
458 U32* const chainTable = ms->chainTable; in ZSTD_insertAndFindFirstIndex_internal()
459 const U32 chainMask = (1 << cParams->chainLog) - 1; in ZSTD_insertAndFindFirstIndex_internal()
460 const BYTE* const base = ms->window.base; in ZSTD_insertAndFindFirstIndex_internal()
462 U32 idx = ms->nextToUpdate; in ZSTD_insertAndFindFirstIndex_internal()
471 ms->nextToUpdate = target; in ZSTD_insertAndFindFirstIndex_internal()
475 U32 ZSTD_insertAndFindFirstIndex(ZSTD_matchState_t* ms, const BYTE* ip) { in ZSTD_insertAndFindFirstIndex() argument
476 const ZSTD_compressionParameters* const cParams = &ms->cParams; in ZSTD_insertAndFindFirstIndex()
477 return ZSTD_insertAndFindFirstIndex_internal(ms, cParams, ip, ms->cParams.minMatch); in ZSTD_insertAndFindFirstIndex()
480 void ZSTD_dedicatedDictSearch_lazy_loadDictionary(ZSTD_matchState_t* ms, const BYTE* const ip) in ZSTD_dedicatedDictSearch_lazy_loadDictionary() argument
482 const BYTE* const base = ms->window.base; in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
484 U32* const hashTable = ms->hashTable; in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
485 U32* const chainTable = ms->chainTable; in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
486 U32 const chainSize = 1 << ms->cParams.chainLog; in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
487 U32 idx = ms->nextToUpdate; in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
489 U32 const bucketSize = 1 << ZSTD_LAZY_DDSS_BUCKET_LOG; in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
490 U32 const cacheSize = bucketSize - 1; in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
491 U32 const chainAttempts = (1 << ms->cParams.searchLog) - cacheSize; in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
495 * We are going to temporarily pretend `bucketSize == 1`, keeping only a in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
499 U32 const hashLog = ms->cParams.hashLog - ZSTD_LAZY_DDSS_BUCKET_LOG; in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
501 U32* const tmpChainTable = hashTable + ((size_t)1 << hashLog); in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
502 U32 const tmpChainSize = ((1 << ZSTD_LAZY_DDSS_BUCKET_LOG) - 1) << hashLog; in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
507 assert(ms->cParams.chainLog <= 24); in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
508 assert(ms->cParams.hashLog >= ms->cParams.chainLog); in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
514 U32 const h = (U32)ZSTD_hashPtr(base + idx, hashLog, ms->cParams.minMatch); in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
524 for (hashIdx = 0; hashIdx < (1U << hashLog); hashIdx++) { in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
571 for (hashIdx = (1 << hashLog); hashIdx; ) { in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
578 hashTable[bucketIdx + bucketSize - 1] = chainPackedPointer; in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
582 for (idx = ms->nextToUpdate; idx < target; idx++) { in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
583 U32 const h = (U32)ZSTD_hashPtr(base + idx, hashLog, ms->cParams.minMatch) in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
586 /* Shift hash cache down 1. */ in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
587 for (i = cacheSize - 1; i; i--) in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
588 hashTable[h + i] = hashTable[h + i - 1]; in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
592 ms->nextToUpdate = target; in ZSTD_dedicatedDictSearch_lazy_loadDictionary()
599 ZSTD_matchState_t* ms, in ZSTD_HcFindBestMatch_generic() argument
604 const ZSTD_compressionParameters* const cParams = &ms->cParams; in ZSTD_HcFindBestMatch_generic()
605 U32* const chainTable = ms->chainTable; in ZSTD_HcFindBestMatch_generic()
606 const U32 chainSize = (1 << cParams->chainLog); in ZSTD_HcFindBestMatch_generic()
607 const U32 chainMask = chainSize-1; in ZSTD_HcFindBestMatch_generic()
608 const BYTE* const base = ms->window.base; in ZSTD_HcFindBestMatch_generic()
609 const BYTE* const dictBase = ms->window.dictBase; in ZSTD_HcFindBestMatch_generic()
610 const U32 dictLimit = ms->window.dictLimit; in ZSTD_HcFindBestMatch_generic()
614 const U32 maxDistance = 1U << cParams->windowLog; in ZSTD_HcFindBestMatch_generic()
615 const U32 lowestValid = ms->window.lowLimit; in ZSTD_HcFindBestMatch_generic()
617 const U32 isDictionary = (ms->loadedDictEnd != 0); in ZSTD_HcFindBestMatch_generic()
620 U32 nbAttempts = 1U << cParams->searchLog; in ZSTD_HcFindBestMatch_generic()
621 size_t ml=4-1; in ZSTD_HcFindBestMatch_generic()
623 const ZSTD_matchState_t* const dms = ms->dictMatchState; in ZSTD_HcFindBestMatch_generic()
637 matchIndex = ZSTD_insertAndFindFirstIndex_internal(ms, cParams, ip, mls); in ZSTD_HcFindBestMatch_generic()
664 assert(nbAttempts <= (1U << ZSTD_SEARCHLOG_MAX)); /* Check we haven't underflowed. */ in ZSTD_HcFindBestMatch_generic()
671 const U32 bucketSize = (1 << ZSTD_LAZY_DDSS_BUCKET_LOG); in ZSTD_HcFindBestMatch_generic()
672 const U32 bucketLimit = nbAttempts < bucketSize - 1 ? nbAttempts : bucketSize - 1; in ZSTD_HcFindBestMatch_generic()
675 for (ddsAttempt = 0; ddsAttempt < bucketSize - 1; ddsAttempt++) { in ZSTD_HcFindBestMatch_generic()
680 U32 const chainPackedPointer = dms->hashTable[ddsIdx + bucketSize - 1]; in ZSTD_HcFindBestMatch_generic()
717 U32 const chainPackedPointer = dms->hashTable[ddsIdx + bucketSize - 1]; in ZSTD_HcFindBestMatch_generic()
752 const U32 dmsChainSize = (1 << dms->cParams.chainLog); in ZSTD_HcFindBestMatch_generic()
753 const U32 dmsChainMask = dmsChainSize - 1; in ZSTD_HcFindBestMatch_generic()
788 ZSTD_matchState_t* ms, in ZSTD_HcFindBestMatch_selectMLS() argument
792 switch(ms->cParams.minMatch) in ZSTD_HcFindBestMatch_selectMLS()
795 case 4 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 4, ZSTD_noDict); in ZSTD_HcFindBestMatch_selectMLS()
796 case 5 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 5, ZSTD_noDict); in ZSTD_HcFindBestMatch_selectMLS()
798 case 6 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 6, ZSTD_noDict); in ZSTD_HcFindBestMatch_selectMLS()
804 ZSTD_matchState_t* ms, in ZSTD_HcFindBestMatch_dictMatchState_selectMLS() argument
808 switch(ms->cParams.minMatch) in ZSTD_HcFindBestMatch_dictMatchState_selectMLS()
811 case 4 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 4, ZSTD_dictMatchState); in ZSTD_HcFindBestMatch_dictMatchState_selectMLS()
812 case 5 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 5, ZSTD_dictMatchState); in ZSTD_HcFindBestMatch_dictMatchState_selectMLS()
814 case 6 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 6, ZSTD_dictMatchState); in ZSTD_HcFindBestMatch_dictMatchState_selectMLS()
820 ZSTD_matchState_t* ms, in ZSTD_HcFindBestMatch_dedicatedDictSearch_selectMLS() argument
824 switch(ms->cParams.minMatch) in ZSTD_HcFindBestMatch_dedicatedDictSearch_selectMLS()
827 …case 4 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 4, ZSTD_dedicatedDictSearc… in ZSTD_HcFindBestMatch_dedicatedDictSearch_selectMLS()
828 …case 5 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 5, ZSTD_dedicatedDictSearc… in ZSTD_HcFindBestMatch_dedicatedDictSearch_selectMLS()
830 …case 6 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 6, ZSTD_dedicatedDictSearc… in ZSTD_HcFindBestMatch_dedicatedDictSearch_selectMLS()
836 ZSTD_matchState_t* ms, in ZSTD_HcFindBestMatch_extDict_selectMLS() argument
840 switch(ms->cParams.minMatch) in ZSTD_HcFindBestMatch_extDict_selectMLS()
843 case 4 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 4, ZSTD_extDict); in ZSTD_HcFindBestMatch_extDict_selectMLS()
844 case 5 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 5, ZSTD_extDict); in ZSTD_HcFindBestMatch_extDict_selectMLS()
846 case 6 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 6, ZSTD_extDict); in ZSTD_HcFindBestMatch_extDict_selectMLS()
858 ZSTD_matchState_t* ms, seqStore_t* seqStore, in ZSTD_compressBlock_lazy_generic() argument
869 const BYTE* const base = ms->window.base; in ZSTD_compressBlock_lazy_generic()
870 const U32 prefixLowestIndex = ms->window.dictLimit; in ZSTD_compressBlock_lazy_generic()
874 ZSTD_matchState_t* ms, in ZSTD_compressBlock_lazy_generic()
903 U32 offset_1 = rep[0], offset_2 = rep[1], savedOffset=0; in ZSTD_compressBlock_lazy_generic()
908 const ZSTD_matchState_t* const dms = ms->dictMatchState; in ZSTD_compressBlock_lazy_generic()
926 U32 const windowLow = ZSTD_getLowestPrefixIndex(ms, curr, ms->cParams.windowLog); in ZSTD_compressBlock_lazy_generic()
948 const BYTE* start=ip+1; in ZSTD_compressBlock_lazy_generic()
952 const U32 repIndex = (U32)(ip - base) + 1 - offset_1; in ZSTD_compressBlock_lazy_generic()
957 if (((U32)((prefixLowestIndex-1) - repIndex) >= 3 /* intentional underflow */) in ZSTD_compressBlock_lazy_generic()
958 && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) { in ZSTD_compressBlock_lazy_generic()
960 … matchLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4; in ZSTD_compressBlock_lazy_generic()
965 && ((offset_1 > 0) & (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1)))) { in ZSTD_compressBlock_lazy_generic()
966 matchLength = ZSTD_count(ip+1+4, ip+1+4-offset_1, iend) + 4; in ZSTD_compressBlock_lazy_generic()
972 size_t const ml2 = searchMax(ms, ip, iend, &offsetFound); in ZSTD_compressBlock_lazy_generic()
978 … ip += ((ip-anchor) >> kSearchStrength) + 1; /* jump faster over incompressible sections */ in ZSTD_compressBlock_lazy_generic()
983 if (depth>=1) in ZSTD_compressBlock_lazy_generic()
990 int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offset+1) + 1); in ZSTD_compressBlock_lazy_generic()
999 if (((U32)((prefixLowestIndex-1) - repIndex) >= 3 /* intentional underflow */) in ZSTD_compressBlock_lazy_generic()
1004 int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offset+1) + 1); in ZSTD_compressBlock_lazy_generic()
1010 size_t const ml2 = searchMax(ms, ip, iend, &offset2); in ZSTD_compressBlock_lazy_generic()
1011 int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */ in ZSTD_compressBlock_lazy_generic()
1012 int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 4); in ZSTD_compressBlock_lazy_generic()
1025 int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 1); in ZSTD_compressBlock_lazy_generic()
1034 if (((U32)((prefixLowestIndex-1) - repIndex) >= 3 /* intentional underflow */) in ZSTD_compressBlock_lazy_generic()
1039 int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 1); in ZSTD_compressBlock_lazy_generic()
1045 size_t const ml2 = searchMax(ms, ip, iend, &offset2); in ZSTD_compressBlock_lazy_generic()
1046 … int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */ in ZSTD_compressBlock_lazy_generic()
1047 int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 7); in ZSTD_compressBlock_lazy_generic()
1056 * start[-offset+ZSTD_REP_MOVE-1] is undefined behavior. in ZSTD_compressBlock_lazy_generic()
1057 * (-offset+ZSTD_REP_MOVE-1) is unsigned, and is added to start, which in ZSTD_compressBlock_lazy_generic()
1064 … && (start[-1] == (start-(offset-ZSTD_REP_MOVE))[-1]) ) /* only search for offset within prefix */ in ZSTD_compressBlock_lazy_generic()
1071 …while ((start>anchor) && (match>mStart) && (start[-1] == match[-1])) { start--; match--; matchLeng… in ZSTD_compressBlock_lazy_generic()
1090 if ( ((U32)((prefixLowestIndex-1) - (U32)repIndex) >= 3 /* intentional overflow */) in ZSTD_compressBlock_lazy_generic()
1118 rep[1] = offset_2 ? offset_2 : savedOffset; in ZSTD_compressBlock_lazy_generic()
1126 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_btlazy2() argument
1129 …return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD… in ZSTD_compressBlock_btlazy2()
1133 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_lazy2() argument
1136 …return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_… in ZSTD_compressBlock_lazy2()
1140 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_lazy() argument
1143 …return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_… in ZSTD_compressBlock_lazy()
1147 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_greedy() argument
1150 …return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0, ZSTD_… in ZSTD_compressBlock_greedy()
1154 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_btlazy2_dictMatchState() argument
1157 …return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD… in ZSTD_compressBlock_btlazy2_dictMatchState()
1161 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_lazy2_dictMatchState() argument
1164 …return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_… in ZSTD_compressBlock_lazy2_dictMatchState()
1168 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_lazy_dictMatchState() argument
1171 …return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_… in ZSTD_compressBlock_lazy_dictMatchState()
1175 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_greedy_dictMatchState() argument
1178 …return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0, ZSTD_… in ZSTD_compressBlock_greedy_dictMatchState()
1183 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_lazy2_dedicatedDictSearch() argument
1186 …return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_… in ZSTD_compressBlock_lazy2_dedicatedDictSearch()
1190 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_lazy_dedicatedDictSearch() argument
1193 …return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_… in ZSTD_compressBlock_lazy_dedicatedDictSearch()
1197 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_greedy_dedicatedDictSearch() argument
1200 …return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0, ZSTD_… in ZSTD_compressBlock_greedy_dedicatedDictSearch()
1206 ZSTD_matchState_t* ms, seqStore_t* seqStore, in ZSTD_compressBlock_lazy_extDict_generic() argument
1216 const BYTE* const base = ms->window.base; in ZSTD_compressBlock_lazy_extDict_generic()
1217 const U32 dictLimit = ms->window.dictLimit; in ZSTD_compressBlock_lazy_extDict_generic()
1219 const BYTE* const dictBase = ms->window.dictBase; in ZSTD_compressBlock_lazy_extDict_generic()
1221 const BYTE* const dictStart = dictBase + ms->window.lowLimit; in ZSTD_compressBlock_lazy_extDict_generic()
1222 const U32 windowLog = ms->cParams.windowLog; in ZSTD_compressBlock_lazy_extDict_generic()
1225 ZSTD_matchState_t* ms, in ZSTD_compressBlock_lazy_extDict_generic()
1229 U32 offset_1 = rep[0], offset_2 = rep[1]; in ZSTD_compressBlock_lazy_extDict_generic()
1246 const BYTE* start=ip+1; in ZSTD_compressBlock_lazy_extDict_generic()
1250 { const U32 windowLow = ZSTD_getLowestMatchIndex(ms, curr+1, windowLog); in ZSTD_compressBlock_lazy_extDict_generic()
1251 const U32 repIndex = (U32)(curr+1 - offset_1); in ZSTD_compressBlock_lazy_extDict_generic()
1254 … if (((U32)((dictLimit-1) - repIndex) >= 3) & (repIndex > windowLow)) /* intentional overflow */ in ZSTD_compressBlock_lazy_extDict_generic()
1255 if (MEM_read32(ip+1) == MEM_read32(repMatch)) { in ZSTD_compressBlock_lazy_extDict_generic()
1258 … matchLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repEnd, prefixStart) + 4; in ZSTD_compressBlock_lazy_extDict_generic()
1264 size_t const ml2 = searchMax(ms, ip, iend, &offsetFound); in ZSTD_compressBlock_lazy_extDict_generic()
1270 … ip += ((ip-anchor) >> kSearchStrength) + 1; /* jump faster over incompressible sections */ in ZSTD_compressBlock_lazy_extDict_generic()
1275 if (depth>=1) in ZSTD_compressBlock_lazy_extDict_generic()
1281 const U32 windowLow = ZSTD_getLowestMatchIndex(ms, curr, windowLog); in ZSTD_compressBlock_lazy_extDict_generic()
1285 … if (((U32)((dictLimit-1) - repIndex) >= 3) & (repIndex > windowLow)) /* intentional overflow */ in ZSTD_compressBlock_lazy_extDict_generic()
1291 int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offset+1) + 1); in ZSTD_compressBlock_lazy_extDict_generic()
1296 /* search match, depth 1 */ in ZSTD_compressBlock_lazy_extDict_generic()
1298 size_t const ml2 = searchMax(ms, ip, iend, &offset2); in ZSTD_compressBlock_lazy_extDict_generic()
1299 int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */ in ZSTD_compressBlock_lazy_extDict_generic()
1300 int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 4); in ZSTD_compressBlock_lazy_extDict_generic()
1312 const U32 windowLow = ZSTD_getLowestMatchIndex(ms, curr, windowLog); in ZSTD_compressBlock_lazy_extDict_generic()
1316 … if (((U32)((dictLimit-1) - repIndex) >= 3) & (repIndex > windowLow)) /* intentional overflow */ in ZSTD_compressBlock_lazy_extDict_generic()
1322 int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 1); in ZSTD_compressBlock_lazy_extDict_generic()
1329 size_t const ml2 = searchMax(ms, ip, iend, &offset2); in ZSTD_compressBlock_lazy_extDict_generic()
1330 … int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */ in ZSTD_compressBlock_lazy_extDict_generic()
1331 int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 7); in ZSTD_compressBlock_lazy_extDict_generic()
1344 …while ((start>anchor) && (match>mStart) && (start[-1] == match[-1])) { start--; match--; matchLeng… in ZSTD_compressBlock_lazy_extDict_generic()
1358 const U32 windowLow = ZSTD_getLowestMatchIndex(ms, repCurrent, windowLog); in ZSTD_compressBlock_lazy_extDict_generic()
1362 … if (((U32)((dictLimit-1) - repIndex) >= 3) & (repIndex > windowLow)) /* intentional overflow */ in ZSTD_compressBlock_lazy_extDict_generic()
1378 rep[1] = offset_2; in ZSTD_compressBlock_lazy_extDict_generic()
1386 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_greedy_extDict() argument
1389 …return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, … in ZSTD_compressBlock_greedy_extDict()
1393 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_lazy_extDict() argument
1397 …return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, … in ZSTD_compressBlock_lazy_extDict()
1401 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_lazy2_extDict() argument
1405 …return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, … in ZSTD_compressBlock_lazy2_extDict()
1409 ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], in ZSTD_compressBlock_btlazy2_extDict() argument
1413 …return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_binaryTree,… in ZSTD_compressBlock_btlazy2_extDict()