Lines Matching refs:m_len
107 code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
109 lzo_uint x_len = m_len;
112 c->match_bytes += (unsigned long) m_len;
121 //if (m_len >= 3 && m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET)
122 if (m_len >= 3 && m_len <= M2_MAX_LEN)
124 //if (m_len == last_m_len && m_off == last_m_off)
136 last_m_len = m_len;
143 if (m_len == 2)
158 else if (m_len <= M2_MAX_LEN && (m_off <= M2_MAX_OFFSET || m_off == c->last_m_off))
160 else if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET)
163 assert(m_len >= 3);
166 *op++ = LZO_BYTE(((m_len - 1) << 5) | ((m_off & 7) << 2));
171 *op++ = LZO_BYTE(((m_len + 1) << 4) | ((m_off & 3) << 2));
176 *op++ = LZO_BYTE(((m_len - 1) << 5) | (0x700 >> 6));
180 *op++ = LZO_BYTE(((m_len - 1) << 5) | (m_off >> 6));
186 else if (m_len == M2_MIN_LEN && m_off <= MX_MAX_OFFSET && c->r1_lit >= 4)
188 assert(m_len == 3);
202 assert(m_len >= 3);
204 if (m_len <= M3_MAX_LEN)
205 *op++ = LZO_BYTE(M3_MARKER | (m_len - 2));
208 m_len -= M3_MAX_LEN;
210 while (m_len > 255)
212 m_len -= 255;
215 assert(m_len > 0);
216 *op++ = LZO_BYTE(m_len);
231 assert(m_len >= 3);
235 if (m_len <= M4_MAX_LEN)
236 *op++ = LZO_BYTE(M4_MARKER | k | (m_len - 2));
239 m_len -= M4_MAX_LEN;
241 while (m_len > 255)
243 m_len -= 255;
246 assert(m_len > 0);
247 *op++ = LZO_BYTE(m_len);
310 lzo_uint lit, lzo_uint m_len )
314 assert(m_len >= 2);
316 c->r1_m_len = m_len;
321 assert(m_len >= 3);
335 len_of_coded_match ( lzo_uint m_len, lzo_uint m_off, lzo_uint lit )
339 if (m_len < 2)
341 if (m_len == 2)
343 if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET)
345 if (m_len == M2_MIN_LEN && m_off <= MX_MAX_OFFSET && lit >= 4)
349 if (m_len <= M3_MAX_LEN)
351 m_len -= M3_MAX_LEN;
352 while (m_len > 255)
354 m_len -= 255;
361 if (m_len <= M4_MAX_LEN)
363 m_len -= M4_MAX_LEN;
364 while (m_len > 255)
366 m_len -= 255;
416 void assert_match( const lzo_swd_p swd, lzo_uint m_len, lzo_uint m_off )
421 assert(m_len >= 2);
424 assert(c->bp - m_off + m_len < c->ip);
425 assert(lzo_memcmp(c->bp, c->bp - m_off, m_len) == 0);
432 if (m_len > d_off)
435 assert(c->in + m_len - d_off < c->ip);
436 assert(lzo_memcmp(c->bp + d_off, c->in, m_len - d_off) == 0);
440 assert(lzo_memcmp(c->bp, swd->dict_end - d_off, m_len) == 0);
452 better_match ( const lzo_swd_p swd, lzo_uint *m_len, lzo_uint *m_off )
458 if (*m_len <= M2_MIN_LEN)
461 if (*m_off == c->last_m_off && *m_len <= M2_MAX_LEN)
464 if (*m_len >= M2_MIN_LEN + 1 && *m_len <= M2_MAX_LEN + 1 &&
465 c->last_m_off && swd->best_off[*m_len-1] == c->last_m_off)
467 *m_len = *m_len - 1;
468 *m_off = swd->best_off[*m_len];
480 *m_len >= M2_MIN_LEN + 1 && *m_len <= M2_MAX_LEN + 1 &&
481 swd->best_off[*m_len-1] && swd->best_off[*m_len-1] <= M2_MAX_OFFSET)
483 *m_len = *m_len - 1;
484 *m_off = swd->best_off[*m_len];
492 *m_len >= M4_MAX_LEN + 1 && *m_len <= M2_MAX_LEN + 2 &&
493 swd->best_off[*m_len-2] && swd->best_off[*m_len-2] <= M2_MAX_OFFSET)
495 *m_len = *m_len - 2;
496 *m_off = swd->best_off[*m_len];
504 *m_len >= M4_MAX_LEN + 1 && *m_len <= M3_MAX_LEN + 1 &&
505 swd->best_off[*m_len-1] && swd->best_off[*m_len-1] <= M3_MAX_OFFSET)
507 *m_len = *m_len - 1;
508 *m_off = swd->best_off[*m_len];
536 lzo_uint m_len, m_off;
604 m_len = c->m_len;
614 if ( m_len < 2 ||
615 (m_len == 2 && (m_off > M1_MAX_OFFSET || lit == 0 || lit >= 4)) ||
621 (m_len == 2 && op == out) ||
626 m_len = 0;
628 else if (m_len == M2_MIN_LEN)
632 m_len = 0;
635 if (m_len == 0)
648 better_match(swd,&m_len,&m_off);
650 assert_match(swd,m_len,m_off);
655 if (try_lazy == 0 || m_len >= max_lazy)
664 l1 = len_of_coded_match(m_len,m_off,lit);
669 max_ahead = LZO_MIN3(try_lazy, l1, m_len - 1);
674 while (ahead < max_ahead && c->look > m_len)
678 if (m_len >= good_length)
691 if (m_len >= M2_MIN_LEN && m_len <= M2_MAX_LEN)
692 c->m_len = 0;
694 if (c->m_len < m_len)
697 if (c->m_len == m_len && c->m_off >= m_off)
702 better_match(swd,&c->m_len,&c->m_off);
704 l2 = len_of_coded_match(c->m_len,c->m_off,lit+ahead);
708 if (c->m_len == m_len && l2 >= l1)
721 if (c->m_len >= m_len + lazy_match_min_gain)
724 assert_match(swd,c->m_len,c->m_off);
747 op = code_run(c,op,ii,lit,m_len);
751 op = code_match(c,op,m_len,m_off);
753 r = find_match(c,swd,m_len,1+ahead);