Lines Matching refs:ip

86 #define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
119 /* Update chains up to ip (excluded) */
120 LZ4_FORCE_INLINE void LZ4HC_Insert (LZ4HC_CCtx_internal* hc4, const BYTE* ip)
126 U32 const target = (U32)(ip - prefixPtr) + prefixIdx;
128 assert(ip >= prefixPtr);
144 * @return : negative value, nb of common bytes before ip/match */
146 int LZ4HC_countBack(const BYTE* const ip, const BYTE* const match,
150 int const min = (int)MAX(iMin - ip, mMin - match);
152 assert(ip >= iMin); assert((size_t)(ip-iMin) < (1U<<31));
155 && (ip[back-1] == match[back-1]) )
177 LZ4HC_countPattern(const BYTE* ip, const BYTE* const iEnd, U32 const pattern32)
179 const BYTE* const iStart = ip;
183 while (likely(ip < iEnd-(sizeof(pattern)-1))) {
184 reg_t const diff = LZ4_read_ARCH(ip) ^ pattern;
185 if (!diff) { ip+=sizeof(pattern); continue; }
186 ip += LZ4_NbCommonBytes(diff);
187 return (unsigned)(ip - iStart);
192 while ((ip<iEnd) && (*ip == (BYTE)patternByte)) {
193 ip++; patternByte >>= 8;
197 while (ip < iEnd) {
199 if (*ip != byte) break;
200 ip ++; bitOffset -= 8;
203 return (unsigned)(ip - iStart);
210 LZ4HC_reverseCountPattern(const BYTE* ip, const BYTE* const iLow, U32 pattern)
212 const BYTE* const iStart = ip;
214 while (likely(ip >= iLow+4)) {
215 if (LZ4_read32(ip-4) != pattern) break;
216 ip -= 4;
219 while (likely(ip>iLow)) {
220 if (ip[-1] != *bytePtr) break;
221 ip--; bytePtr--;
223 return (unsigned)(iStart - ip);
242 const BYTE* const ip,
257 const U32 ipIndex = (U32)(ip - prefixPtr) + prefixIdx;
263 int const lookBackLength = (int)(ip-iLowLimit);
266 U32 const pattern = LZ4_read32(ip);
273 LZ4HC_Insert(hc4, ip);
274 matchIndex = HashTable[LZ4HC_hashPtr(ip)];
286 assert(matchPtr < ip);
290 int const back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, prefixPtr) : 0;
291 matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
296 *startpos = ip + back;
304 const BYTE* vLimit = ip + (prefixIdx - matchIndex);
306 matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
307 if ((ip+matchLength == vLimit) && (vLimit < iHighLimit))
308 matchLength += LZ4_count(ip+matchLength, prefixPtr, iHighLimit);
309 back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, dictStart) : 0;
313 *matchpos = prefixPtr - prefixIdx + matchIndex + back; /* virtual pos, relative to ip, to retrieve offset */
314 *startpos = ip + back;
348 srcPatternLength = LZ4HC_countPattern(ip+sizeof(pattern), iHighLimit, pattern) + sizeof(pattern);
397 assert(prefixPtr - prefixIdx + matchIndex != ip);
398 if ((size_t)(ip - prefixPtr) + prefixIdx - matchIndex > LZ4_DISTANCE_MAX) break;
401 *matchpos = prefixPtr - prefixIdx + matchIndex; /* virtual pos, relative to ip, to retrieve offset */
402 *startpos = ip;
421 U32 dictMatchIndex = dictCtx->hashTable[LZ4HC_hashPtr(ip)];
430 const BYTE* vLimit = ip + (dictEndOffset - dictMatchIndex);
432 mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
433 back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, dictCtx->prefixStart) : 0;
438 *startpos = ip + back;
451 const BYTE* const ip, const BYTE* const iLimit,
457 const BYTE* uselessPtr = ip;
459 * but this won't be the case here, as we define iLowLimit==ip,
460 * so LZ4HC_InsertAndGetWiderMatch() won't be allowed to search past ip */
461 return LZ4HC_InsertAndGetWiderMatch(hc4, ip, ip, iLimit, MINMATCH-1, matchpos, &uselessPtr, maxNbAttempts, patternAnalysis, 0 /*chainSwap*/, dict, favorCompressionRatio);
476 #define ip (*_ip)
487 U32 const ll = (U32)(ip - anchor);
495 (U32)(ip - anchor), matchLength, (U32)(ip-match),
501 length = (size_t)(ip - anchor);
523 assert( (ip - match) <= LZ4_DISTANCE_MAX ); /* note : consider providing offset as a value, rather than as a pointer difference */
524 LZ4_writeLE16(op, (U16)(ip - match)); op += 2;
544 ip += matchLength;
545 anchor = ip;
549 #undef ip
567 const BYTE* ip = (const BYTE*) source;
568 const BYTE* anchor = ip;
569 const BYTE* const iend = ip + inputSize;
592 while (ip <= mflimit) {
593 ml = LZ4HC_InsertAndFindBestMatch(ctx, ip, matchlimit, &ref, maxNbAttempts, patternAnalysis, dict);
594 if (ml<MINMATCH) { ip++; continue; }
597 start0 = ip; ref0 = ref; ml0 = ml;
600 if (ip+ml <= mflimit) {
602 ip + ml - 2, ip + 0, matchlimit, ml, &ref2, &start2,
610 if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, ref, limit, oend)) goto _dest_overflow;
614 if (start0 < ip) { /* first match was skipped at least once */
615 if (start2 < ip + ml0) { /* squeezing ML1 between ML0(original ML1) and ML2 */
616 ip = start0; ref = ref0; ml = ml0; /* restore initial ML1 */
619 /* Here, start0==ip */
620 if ((start2 - ip) < 3) { /* First Match too small : removed */
622 ip = start2;
631 if ((start2 - ip) < OPTIMAL_ML) {
635 if (ip+new_ml > start2 + ml2 - MINMATCH) new_ml = (int)(start2 - ip) + ml2 - MINMATCH;
636 correction = new_ml - (int)(start2 - ip);
643 /* Now, we have start2 = ip+new_ml, with new_ml = min(ml, OPTIMAL_ML=18) */
654 /* ip & ref are known; Now for ml */
655 if (start2 < ip+ml) ml = (int)(start2 - ip);
658 if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, ref, limit, oend)) goto _dest_overflow;
659 ip = start2;
661 if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml2, ref2, limit, oend)) {
669 if (start3 < ip+ml+3) { /* Not enough space for match 2 : remove it */
670 if (start3 >= (ip+ml)) { /* can write Seq1 immediately ==> Seq2 is removed, so Seq3 becomes Seq1 */
671 if (start2 < ip+ml) {
672 int correction = (int)(ip+ml - start2);
684 if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, ref, limit, oend)) goto _dest_overflow;
685 ip = start3;
704 * ip & ref are known; Now decide ml.
706 if (start2 < ip+ml) {
707 if ((start2 - ip) < OPTIMAL_ML) {
710 if (ip + ml > start2 + ml2 - MINMATCH) ml = (int)(start2 - ip) + ml2 - MINMATCH;
711 correction = ml - (int)(start2 - ip);
718 ml = (int)(start2 - ip);
722 if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, ref, limit, oend)) goto _dest_overflow;
725 ip = start2; ref = ref2; ml = ml2;
748 ip = anchor + lastRunSize; /* can be != iend if limit==fillOutput */
763 *srcSizePtr = (int) (((const char*)ip) - source);
768 /* Assumption : ip, anchor, ml and ref must be set correctly */
769 size_t const ll = (size_t)(ip - anchor);
782 LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, ref, notLimited, oend);
1309 const BYTE* ip, const BYTE* const iHighLimit,
1317 * but this won't be the case here, as we define iLowLimit==ip,
1318 * so LZ4HC_InsertAndGetWiderMatch() won't be allowed to search past ip */
1319 int matchLength = LZ4HC_InsertAndGetWiderMatch(ctx, ip, ip, iHighLimit, minLen, &matchPtr, &ip, nbSearches, 1 /*patternAnalysis*/, 1 /*chainSwap*/, dict, favorDecSpeed);
1325 match.off = (int)(ip-matchPtr);
1350 const BYTE* ip = (const BYTE*) source;
1351 const BYTE* anchor = ip;
1352 const BYTE* const iend = ip + *srcSizePtr;
1371 while (ip <= mflimit) {
1372 int const llen = (int)(ip - anchor);
1376 LZ4HC_match_t const firstMatch = LZ4HC_FindLongerMatch(ctx, ip, matchlimit, MINMATCH-1, nbSearches, dict, favorDecSpeed);
1377 if (firstMatch.len==0) { ip++; continue; }
1382 const BYTE* const matchPos = ip - firstMatch.off;
1384 if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), firstML, matchPos, limit, oend) ) { /* updates ip, op and anchor */
1430 const BYTE* const curPtr = ip + cur;
1551 { int rPos = 0; /* relative position (to ip) */
1555 if (ml == 1) { ip++; rPos++; continue; } /* literal; note: can end up with several literals, in which case, skip them */
1560 if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, ip - offset, limit, oend) ) { /* updates ip, op and anchor */
1562 ovref = ip - offset;
1565 } /* while (ip <= mflimit) */
1584 ip = anchor + lastRunSize; /* can be != iend if limit==fillOutput */
1599 *srcSizePtr = (int) (((const char*)ip) - source);
1605 /* Assumption : ip, anchor, ovml and ovref must be set correctly */
1606 size_t const ll = (size_t)(ip - anchor);
1620 DEBUGLOG(6, "Before : ip = %p, anchor = %p", ip, anchor);
1621 LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ovml, ovref, notLimited, oend);
1622 DEBUGLOG(6, "After : ip = %p, anchor = %p", ip, anchor);