* The maximum permissible match length at this position.
* @nice_len
* Stop searching if a match of at least this length is found.
+ * Must be <= @max_len.
* @max_search_depth
- * Limit on the number of potential matches to consider.
+ * Limit on the number of potential matches to consider. Must be >= 1.
* @offset_ret
* If a match is found, its offset is returned in this location.
*
pos_t cur_node;
/* Insert the current sequence into the appropriate linked list. */
- if (unlikely(max_len < LZ_HASH_REQUIRED_NBYTES))
+ if (unlikely(max_len < LOAD_U24_REQUIRED_NBYTES))
goto out;
first_3_bytes = load_u24_unaligned(in_next);
hash = lz_hash(first_3_bytes, HC_MATCHFINDER_HASH_ORDER);
for (;;) {
matchptr = &in_begin[cur_node];
- /* Already found a length 3 match. Try for a longer match;
- * start by checking the last 2 bytes and the first 4 bytes. */
+ /* Already found a length 3 match. Try for a longer
+ * match; start by checking either the last 4 bytes and
+ * the first 4 bytes, or the last byte. (The last byte,
+ * the one which would extend the match length by 1, is
+ * the most important.) */
#if UNALIGNED_ACCESS_IS_FAST
if ((load_u32_unaligned(matchptr + best_len - 3) ==
load_u32_unaligned(in_next + best_len - 3)) &&
{
u32 hash;
- if (unlikely(in_next + count >= in_end - LZ_HASH_REQUIRED_NBYTES))
+ if (unlikely(in_next + count >= in_end - LZ_HASH3_REQUIRED_NBYTES))
return;
do {