Lines Matching +full:4 +full:- +full:byte
5 * This source code is licensed under both the BSD-style license (found in the
8 * You may select, at your option, one of the above-listed licenses.
19 const ZSTD_compressionParameters* const cParams = &ms->cParams; in ZSTD_fillHashTable()
20 U32* const hashTable = ms->hashTable; in ZSTD_fillHashTable()
21 U32 const hBits = cParams->hashLog; in ZSTD_fillHashTable()
22 U32 const mls = cParams->minMatch; in ZSTD_fillHashTable()
23 const BYTE* const base = ms->window.base; in ZSTD_fillHashTable()
24 const BYTE* ip = base + ms->nextToUpdate; in ZSTD_fillHashTable()
25 const BYTE* const iend = ((const BYTE*)end) - HASH_READ_SIZE; in ZSTD_fillHashTable()
32 U32 const curr = (U32)(ip - base); in ZSTD_fillHashTable()
48 * given position is broken into 4 stages:
53 * 4. Compare
59 * Rather than do 1->2->3->4 sequentially for a single position before moving
68 * Pos | Time -->
69 * ----+-------------------
74 * N+4 | R H T M
83 * to re-enter the loop:
85 * Pos | Time -->
86 * ----+-------------------
98 const ZSTD_compressionParameters* const cParams = &ms->cParams; in ZSTD_compressBlock_fast_noDict_generic()
99 U32* const hashTable = ms->hashTable; in ZSTD_compressBlock_fast_noDict_generic()
100 U32 const hlog = cParams->hashLog; in ZSTD_compressBlock_fast_noDict_generic()
102 size_t const stepSize = hasStep ? (cParams->targetLength + !(cParams->targetLength) + 1) : 2; in ZSTD_compressBlock_fast_noDict_generic()
103 const BYTE* const base = ms->window.base; in ZSTD_compressBlock_fast_noDict_generic()
104 const BYTE* const istart = (const BYTE*)src; in ZSTD_compressBlock_fast_noDict_generic()
105 const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); in ZSTD_compressBlock_fast_noDict_generic()
106 const U32 prefixStartIndex = ZSTD_getLowestPrefixIndex(ms, endIndex, cParams->windowLog); in ZSTD_compressBlock_fast_noDict_generic()
107 const BYTE* const prefixStart = base + prefixStartIndex; in ZSTD_compressBlock_fast_noDict_generic()
108 const BYTE* const iend = istart + srcSize; in ZSTD_compressBlock_fast_noDict_generic()
109 const BYTE* const ilimit = iend - HASH_READ_SIZE; in ZSTD_compressBlock_fast_noDict_generic()
111 const BYTE* anchor = istart; in ZSTD_compressBlock_fast_noDict_generic()
112 const BYTE* ip0 = istart; in ZSTD_compressBlock_fast_noDict_generic()
113 const BYTE* ip1; in ZSTD_compressBlock_fast_noDict_generic()
114 const BYTE* ip2; in ZSTD_compressBlock_fast_noDict_generic()
115 const BYTE* ip3; in ZSTD_compressBlock_fast_noDict_generic()
128 const BYTE* match0; in ZSTD_compressBlock_fast_noDict_generic()
136 const BYTE* nextStep; in ZSTD_compressBlock_fast_noDict_generic()
137 const size_t kStepIncr = (1 << (kSearchStrength - 1)); in ZSTD_compressBlock_fast_noDict_generic()
141 { U32 const curr = (U32)(ip0 - base); in ZSTD_compressBlock_fast_noDict_generic()
142 U32 const windowLow = ZSTD_getLowestPrefixIndex(ms, curr, cParams->windowLog); in ZSTD_compressBlock_fast_noDict_generic()
143 U32 const maxRep = curr - windowLow; in ZSTD_compressBlock_fast_noDict_generic()
154 /* calculate positions, ip0 - anchor == 0, so we skip step calc */ in ZSTD_compressBlock_fast_noDict_generic()
170 const U32 rval = MEM_read32(ip2 - rep_offset1); in ZSTD_compressBlock_fast_noDict_generic()
173 current0 = (U32)(ip0 - base); in ZSTD_compressBlock_fast_noDict_generic()
179 match0 = ip0 - rep_offset1; in ZSTD_compressBlock_fast_noDict_generic()
180 mLength = ip0[-1] == match0[-1]; in ZSTD_compressBlock_fast_noDict_generic()
181 ip0 -= mLength; in ZSTD_compressBlock_fast_noDict_generic()
182 match0 -= mLength; in ZSTD_compressBlock_fast_noDict_generic()
184 mLength += 4; in ZSTD_compressBlock_fast_noDict_generic()
214 current0 = (U32)(ip0 - base); in ZSTD_compressBlock_fast_noDict_generic()
262 return (size_t)(iend - anchor); in ZSTD_compressBlock_fast_noDict_generic()
269 rep_offset1 = (U32)(ip0-match0); in ZSTD_compressBlock_fast_noDict_generic()
271 mLength = 4; in ZSTD_compressBlock_fast_noDict_generic()
274 while (((ip0>anchor) & (match0>prefixStart)) && (ip0[-1] == match0[-1])) { in ZSTD_compressBlock_fast_noDict_generic()
275 ip0--; in ZSTD_compressBlock_fast_noDict_generic()
276 match0--; in ZSTD_compressBlock_fast_noDict_generic()
285 ZSTD_storeSeq(seqStore, (size_t)(ip0 - anchor), anchor, iend, offcode, mLength); in ZSTD_compressBlock_fast_noDict_generic()
292 hashTable[hash1] = (U32)(ip1 - base); in ZSTD_compressBlock_fast_noDict_generic()
299 …_hashPtr(base+current0+2, hlog, mls)] = current0+2; /* here because current+2 could be > iend-8 */ in ZSTD_compressBlock_fast_noDict_generic()
300 hashTable[ZSTD_hashPtr(ip0-2, hlog, mls)] = (U32)(ip0-2-base); in ZSTD_compressBlock_fast_noDict_generic()
303 while ( (ip0 <= ilimit) && (MEM_read32(ip0) == MEM_read32(ip0 - rep_offset2)) ) { in ZSTD_compressBlock_fast_noDict_generic()
305 size_t const rLength = ZSTD_count(ip0+4, ip0+4-rep_offset2, iend) + 4; in ZSTD_compressBlock_fast_noDict_generic()
307 hashTable[ZSTD_hashPtr(ip0, hlog, mls)] = (U32)(ip0-base); in ZSTD_compressBlock_fast_noDict_generic()
311 continue; /* faster when present (confirmed on gcc-8) ... (?) */ in ZSTD_compressBlock_fast_noDict_generic()
325 ZSTD_GEN_FAST_FN(noDict, 4, 1)
330 ZSTD_GEN_FAST_FN(noDict, 4, 0)
339 U32 const mls = ms->cParams.minMatch; in ZSTD_compressBlock_fast()
340 assert(ms->dictMatchState == NULL); in ZSTD_compressBlock_fast()
341 if (ms->cParams.targetLength > 1) { in ZSTD_compressBlock_fast()
345 case 4 : in ZSTD_compressBlock_fast()
358 case 4 : in ZSTD_compressBlock_fast()
376 const ZSTD_compressionParameters* const cParams = &ms->cParams; in ZSTD_compressBlock_fast_dictMatchState_generic()
377 U32* const hashTable = ms->hashTable; in ZSTD_compressBlock_fast_dictMatchState_generic()
378 U32 const hlog = cParams->hashLog; in ZSTD_compressBlock_fast_dictMatchState_generic()
380 U32 const stepSize = cParams->targetLength + !(cParams->targetLength); in ZSTD_compressBlock_fast_dictMatchState_generic()
381 const BYTE* const base = ms->window.base; in ZSTD_compressBlock_fast_dictMatchState_generic()
382 const BYTE* const istart = (const BYTE*)src; in ZSTD_compressBlock_fast_dictMatchState_generic()
383 const BYTE* ip = istart; in ZSTD_compressBlock_fast_dictMatchState_generic()
384 const BYTE* anchor = istart; in ZSTD_compressBlock_fast_dictMatchState_generic()
385 const U32 prefixStartIndex = ms->window.dictLimit; in ZSTD_compressBlock_fast_dictMatchState_generic()
386 const BYTE* const prefixStart = base + prefixStartIndex; in ZSTD_compressBlock_fast_dictMatchState_generic()
387 const BYTE* const iend = istart + srcSize; in ZSTD_compressBlock_fast_dictMatchState_generic()
388 const BYTE* const ilimit = iend - HASH_READ_SIZE; in ZSTD_compressBlock_fast_dictMatchState_generic()
392 const ZSTD_matchState_t* const dms = ms->dictMatchState; in ZSTD_compressBlock_fast_dictMatchState_generic()
393 const ZSTD_compressionParameters* const dictCParams = &dms->cParams ; in ZSTD_compressBlock_fast_dictMatchState_generic()
394 const U32* const dictHashTable = dms->hashTable; in ZSTD_compressBlock_fast_dictMatchState_generic()
395 const U32 dictStartIndex = dms->window.dictLimit; in ZSTD_compressBlock_fast_dictMatchState_generic()
396 const BYTE* const dictBase = dms->window.base; in ZSTD_compressBlock_fast_dictMatchState_generic()
397 const BYTE* const dictStart = dictBase + dictStartIndex; in ZSTD_compressBlock_fast_dictMatchState_generic()
398 const BYTE* const dictEnd = dms->window.nextSrc; in ZSTD_compressBlock_fast_dictMatchState_generic()
399 const U32 dictIndexDelta = prefixStartIndex - (U32)(dictEnd - dictBase); in ZSTD_compressBlock_fast_dictMatchState_generic()
400 const U32 dictAndPrefixLength = (U32)(ip - prefixStart + dictEnd - dictStart); in ZSTD_compressBlock_fast_dictMatchState_generic()
401 const U32 dictHLog = dictCParams->hashLog; in ZSTD_compressBlock_fast_dictMatchState_generic()
405 const U32 maxDistance = 1U << cParams->windowLog; in ZSTD_compressBlock_fast_dictMatchState_generic()
406 const U32 endIndex = (U32)((size_t)(ip - base) + srcSize); in ZSTD_compressBlock_fast_dictMatchState_generic()
407 assert(endIndex - prefixStartIndex <= maxDistance); in ZSTD_compressBlock_fast_dictMatchState_generic()
414 assert(prefixStartIndex >= (U32)(dictEnd - dictBase)); in ZSTD_compressBlock_fast_dictMatchState_generic()
428 U32 const curr = (U32)(ip-base); in ZSTD_compressBlock_fast_dictMatchState_generic()
430 const BYTE* match = base + matchIndex; in ZSTD_compressBlock_fast_dictMatchState_generic()
431 const U32 repIndex = curr + 1 - offset_1; in ZSTD_compressBlock_fast_dictMatchState_generic()
432 const BYTE* repMatch = (repIndex < prefixStartIndex) ? in ZSTD_compressBlock_fast_dictMatchState_generic()
433 dictBase + (repIndex - dictIndexDelta) : in ZSTD_compressBlock_fast_dictMatchState_generic()
437 …if ( ((U32)((prefixStartIndex-1) - repIndex) >= 3) /* intentional underflow : ensure repIndex isn'… in ZSTD_compressBlock_fast_dictMatchState_generic()
439 const BYTE* const repMatchEnd = repIndex < prefixStartIndex ? dictEnd : iend; in ZSTD_compressBlock_fast_dictMatchState_generic()
440 mLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixStart) + 4; in ZSTD_compressBlock_fast_dictMatchState_generic()
442 ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, STORE_REPCODE_1, mLength); in ZSTD_compressBlock_fast_dictMatchState_generic()
446 const BYTE* dictMatch = dictBase + dictMatchIndex; in ZSTD_compressBlock_fast_dictMatchState_generic()
450 ip += ((ip-anchor) >> kSearchStrength) + stepSize; in ZSTD_compressBlock_fast_dictMatchState_generic()
454 U32 const offset = (U32)(curr-dictMatchIndex-dictIndexDelta); in ZSTD_compressBlock_fast_dictMatchState_generic()
455 mLength = ZSTD_count_2segments(ip+4, dictMatch+4, iend, dictEnd, prefixStart) + 4; in ZSTD_compressBlock_fast_dictMatchState_generic()
457 && (ip[-1] == dictMatch[-1])) { in ZSTD_compressBlock_fast_dictMatchState_generic()
458 ip--; dictMatch--; mLength++; in ZSTD_compressBlock_fast_dictMatchState_generic()
462 … ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, STORE_OFFSET(offset), mLength); in ZSTD_compressBlock_fast_dictMatchState_generic()
467 ip += ((ip-anchor) >> kSearchStrength) + stepSize; in ZSTD_compressBlock_fast_dictMatchState_generic()
471 U32 const offset = (U32)(ip-match); in ZSTD_compressBlock_fast_dictMatchState_generic()
472 mLength = ZSTD_count(ip+4, match+4, iend) + 4; in ZSTD_compressBlock_fast_dictMatchState_generic()
474 && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */ in ZSTD_compressBlock_fast_dictMatchState_generic()
477 … ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, STORE_OFFSET(offset), mLength); in ZSTD_compressBlock_fast_dictMatchState_generic()
487 …hTable[ZSTD_hashPtr(base+curr+2, hlog, mls)] = curr+2; /* here because curr+2 could be > iend-8 */ in ZSTD_compressBlock_fast_dictMatchState_generic()
488 hashTable[ZSTD_hashPtr(ip-2, hlog, mls)] = (U32)(ip-2-base); in ZSTD_compressBlock_fast_dictMatchState_generic()
492 U32 const current2 = (U32)(ip-base); in ZSTD_compressBlock_fast_dictMatchState_generic()
493 U32 const repIndex2 = current2 - offset_2; in ZSTD_compressBlock_fast_dictMatchState_generic()
494 const BYTE* repMatch2 = repIndex2 < prefixStartIndex ? in ZSTD_compressBlock_fast_dictMatchState_generic()
495 dictBase - dictIndexDelta + repIndex2 : in ZSTD_compressBlock_fast_dictMatchState_generic()
497 if ( ((U32)((prefixStartIndex-1) - (U32)repIndex2) >= 3 /* intentional overflow */) in ZSTD_compressBlock_fast_dictMatchState_generic()
499 const BYTE* const repEnd2 = repIndex2 < prefixStartIndex ? dictEnd : iend; in ZSTD_compressBlock_fast_dictMatchState_generic()
500 … size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixStart) + 4; in ZSTD_compressBlock_fast_dictMatchState_generic()
518 return (size_t)(iend - anchor); in ZSTD_compressBlock_fast_dictMatchState_generic()
522 ZSTD_GEN_FAST_FN(dictMatchState, 4, 0)
531 U32 const mls = ms->cParams.minMatch; in ZSTD_compressBlock_fast_dictMatchState()
532 assert(ms->dictMatchState != NULL); in ZSTD_compressBlock_fast_dictMatchState()
536 case 4 : in ZSTD_compressBlock_fast_dictMatchState()
552 const ZSTD_compressionParameters* const cParams = &ms->cParams; in ZSTD_compressBlock_fast_extDict_generic()
553 U32* const hashTable = ms->hashTable; in ZSTD_compressBlock_fast_extDict_generic()
554 U32 const hlog = cParams->hashLog; in ZSTD_compressBlock_fast_extDict_generic()
556 U32 const stepSize = cParams->targetLength + !(cParams->targetLength); in ZSTD_compressBlock_fast_extDict_generic()
557 const BYTE* const base = ms->window.base; in ZSTD_compressBlock_fast_extDict_generic()
558 const BYTE* const dictBase = ms->window.dictBase; in ZSTD_compressBlock_fast_extDict_generic()
559 const BYTE* const istart = (const BYTE*)src; in ZSTD_compressBlock_fast_extDict_generic()
560 const BYTE* ip = istart; in ZSTD_compressBlock_fast_extDict_generic()
561 const BYTE* anchor = istart; in ZSTD_compressBlock_fast_extDict_generic()
562 const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); in ZSTD_compressBlock_fast_extDict_generic()
563 const U32 lowLimit = ZSTD_getLowestMatchIndex(ms, endIndex, cParams->windowLog); in ZSTD_compressBlock_fast_extDict_generic()
565 const BYTE* const dictStart = dictBase + dictStartIndex; in ZSTD_compressBlock_fast_extDict_generic()
566 const U32 dictLimit = ms->window.dictLimit; in ZSTD_compressBlock_fast_extDict_generic()
568 const BYTE* const prefixStart = base + prefixStartIndex; in ZSTD_compressBlock_fast_extDict_generic()
569 const BYTE* const dictEnd = dictBase + prefixStartIndex; in ZSTD_compressBlock_fast_extDict_generic()
570 const BYTE* const iend = istart + srcSize; in ZSTD_compressBlock_fast_extDict_generic()
571 const BYTE* const ilimit = iend - 8; in ZSTD_compressBlock_fast_extDict_generic()
586 const BYTE* const matchBase = matchIndex < prefixStartIndex ? dictBase : base; in ZSTD_compressBlock_fast_extDict_generic()
587 const BYTE* match = matchBase + matchIndex; in ZSTD_compressBlock_fast_extDict_generic()
588 const U32 curr = (U32)(ip-base); in ZSTD_compressBlock_fast_extDict_generic()
589 const U32 repIndex = curr + 1 - offset_1; in ZSTD_compressBlock_fast_extDict_generic()
590 const BYTE* const repBase = repIndex < prefixStartIndex ? dictBase : base; in ZSTD_compressBlock_fast_extDict_generic()
591 const BYTE* const repMatch = repBase + repIndex; in ZSTD_compressBlock_fast_extDict_generic()
595 if ( ( ((U32)((prefixStartIndex-1) - repIndex) >= 3) /* intentional underflow */ in ZSTD_compressBlock_fast_extDict_generic()
596 & (offset_1 <= curr+1 - dictStartIndex) ) /* note: we are searching at curr+1 */ in ZSTD_compressBlock_fast_extDict_generic()
598 const BYTE* const repMatchEnd = repIndex < prefixStartIndex ? dictEnd : iend; in ZSTD_compressBlock_fast_extDict_generic()
599 …size_t const rLength = ZSTD_count_2segments(ip+1 +4, repMatch +4, iend, repMatchEnd, prefixStart) … in ZSTD_compressBlock_fast_extDict_generic()
601 ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, STORE_REPCODE_1, rLength); in ZSTD_compressBlock_fast_extDict_generic()
608 ip += ((ip-anchor) >> kSearchStrength) + stepSize; in ZSTD_compressBlock_fast_extDict_generic()
611 { const BYTE* const matchEnd = matchIndex < prefixStartIndex ? dictEnd : iend; in ZSTD_compressBlock_fast_extDict_generic()
612 … const BYTE* const lowMatchPtr = matchIndex < prefixStartIndex ? dictStart : prefixStart; in ZSTD_compressBlock_fast_extDict_generic()
613 U32 const offset = curr - matchIndex; in ZSTD_compressBlock_fast_extDict_generic()
614 … size_t mLength = ZSTD_count_2segments(ip+4, match+4, iend, matchEnd, prefixStart) + 4; in ZSTD_compressBlock_fast_extDict_generic()
615 …while (((ip>anchor) & (match>lowMatchPtr)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; }… in ZSTD_compressBlock_fast_extDict_generic()
617 … ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, STORE_OFFSET(offset), mLength); in ZSTD_compressBlock_fast_extDict_generic()
625 hashTable[ZSTD_hashPtr(ip-2, hlog, mls)] = (U32)(ip-2-base); in ZSTD_compressBlock_fast_extDict_generic()
628 U32 const current2 = (U32)(ip-base); in ZSTD_compressBlock_fast_extDict_generic()
629 U32 const repIndex2 = current2 - offset_2; in ZSTD_compressBlock_fast_extDict_generic()
630 …const BYTE* const repMatch2 = repIndex2 < prefixStartIndex ? dictBase + repIndex2 : base + repInde… in ZSTD_compressBlock_fast_extDict_generic()
631 …if ( (((U32)((prefixStartIndex-1) - repIndex2) >= 3) & (offset_2 <= curr - dictStartIndex)) /* in… in ZSTD_compressBlock_fast_extDict_generic()
633 const BYTE* const repEnd2 = repIndex2 < prefixStartIndex ? dictEnd : iend; in ZSTD_compressBlock_fast_extDict_generic()
634 … size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixStart) + 4; in ZSTD_compressBlock_fast_extDict_generic()
650 return (size_t)(iend - anchor); in ZSTD_compressBlock_fast_extDict_generic()
653 ZSTD_GEN_FAST_FN(extDict, 4, 0)
662 U32 const mls = ms->cParams.minMatch; in ZSTD_compressBlock_fast_extDict()
666 case 4 : in ZSTD_compressBlock_fast_extDict()