Lines Matching refs:match

18  *      string matches are performed only when the previous match ends. So it
22 * is used to find longer strings when a small match has been found.
96 local void check_match OF((deflate_state *s, IPos start, IPos match,
118 ush good_length; /* reduce lazy search above this match length */
119 ush max_lazy; /* do not perform lazy search above this match length */
120 ush nice_length; /* quit search above this match length */
1104 * Initialize the "longest match" routines for a new zlib stream
1136 * Set match_start to the longest match starting at the given string and
1142 * OUT assertion: the match length is not greater than s->lookahead.
1145 /* For 80x86 and 680x0, an optimized version will be provided in match.asm or
1146 * match.S. The code will be functionally equivalent.
1150 IPos cur_match; /* current match */
1154 register Bytef *match; /* matched string */
1155 register int len; /* length of current match */
1156 int best_len = s->prev_length; /* best match length so far */
1157 int nice_match = s->nice_match; /* stop if match long enough */
1184 /* Do not waste too much time if we already have a good match: */
1197 match = s->window + cur_match;
1199 /* Skip to next match if the match length cannot increase
1200 * or if the match length is less than 2. Note that the checks below
1204 * However the length of the match is limited to the lookahead, so
1211 if (*(ushf*)(match+best_len-1) != scan_end ||
1212 *(ushf*)match != scan_start) continue;
1214 /* It is not necessary to compare scan[2] and match[2] since they are
1215 * always equal when the other bytes match, given that the hash keys
1223 Assert(scan[2] == match[2], "scan[2]?");
1224 scan++, match++;
1226 } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
1227 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
1228 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
1229 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
1235 if (*scan == *match) scan++;
1242 if (match[best_len] != scan_end ||
1243 match[best_len-1] != scan_end1 ||
1244 *match != *scan ||
1245 *++match != scan[1]) continue;
1249 * It is not necessary to compare scan[2] and match[2] since they
1250 * are always equal when the other bytes match, given that
1253 scan += 2, match++;
1254 Assert(*scan == *match, "match[2]?");
1260 } while (*++scan == *++match && *++scan == *++match &&
1261 *++scan == *++match && *++scan == *++match &&
1262 *++scan == *++match && *++scan == *++match &&
1263 *++scan == *++match && *++scan == *++match &&
1299 IPos cur_match; /* current match */
1302 register Bytef *match; /* matched string */
1303 register int len; /* length of current match */
1315 match = s->window + cur_match;
1317 /* Return failure if the match length is less than 2:
1319 if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
1323 * It is not necessary to compare scan[2] and match[2] since they
1324 * are always equal when the other bytes match, given that
1327 scan += 2, match += 2;
1328 Assert(*scan == *match, "match[2]?");
1334 } while (*++scan == *++match && *++scan == *++match &&
1335 *++scan == *++match && *++scan == *++match &&
1336 *++scan == *++match && *++scan == *++match &&
1337 *++scan == *++match && *++scan == *++match &&
1354 * Check that the match at match_start is indeed a match.
1356 local void check_match(s, start, match, length)
1358 IPos start, match;
1361 /* check that the match is indeed a match */
1362 if (zmemcmp(s->window + match,
1364 fprintf(stderr, " start %u, match %u, length %d\n",
1365 start, match, length);
1367 fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
1369 z_error("invalid match");
1372 fprintf(stderr,"\\[%d,%d]", start-match, length);
1377 # define check_match(s, start, match, length)
1499 * the longest match routines. Update the high water mark for the next
1500 * time through here. WIN_INIT is set to MAX_MATCH since the longest match
1536 * IN assertion: strstart is set to the end of the current match.
1638 * for the next match, plus MIN_MATCH bytes to insert the
1639 * string following the next match.
1657 /* Find the longest match, discarding those <= prev_length.
1662 * of window index 0 (in particular we have to avoid a match
1676 /* Insert new strings in the hash table only if the match length
1706 /* No match, output a literal byte */
1727 * evaluation for matches: a match is finally adopted only if there is
1728 * no better match at the next window position.
1741 * for the next match, plus MIN_MATCH bytes to insert the
1742 * string following the next match.
1760 /* Find the longest match, discarding those <= prev_length.
1768 * of window index 0 (in particular we have to avoid a match
1782 * but we will ignore the current match anyway.
1787 /* If there was a match at the previous step and the current
1788 * match is not better, output the previous match:
1799 /* Insert in hash table all strings up to the end of the match.
1818 /* If there was no match at the previous position, output a
1819 * single literal. If there was a match but the current match
1820 * is longer, truncate the previous match to a single literal.
1831 /* There is no previous match to compare with, wait for
1866 uInt prev; /* byte at distance one to match */
1902 /* Emit match if have run of MIN_MATCH or longer, else emit literal */
1912 /* No match, output a literal byte */