static void swd_findbest(ucl_swd_t *s) { DWORD key; DWORD cnt, node; DWORD len; /* get current head, add bp into HEAD3 */ key = HEAD3(s->b,s->bp); node = s->succ3[s->bp] = s->head3[key]; cnt = s->llen3[key]++; if(cnt > s->max_chain && s->max_chain > 0)cnt = s->max_chain; s->head3[key] = s->bp; s->b_char = s->b[s->bp]; len = s->m_len; if(s->m_len >= s->look) { if (s->look == 0)s->b_char = -1; s->m_off = 0; s->best3[s->bp] = SWD_F + 1; } else { if(swd_search2(s) && s->look >= 3)swd_search(s,node,cnt); if(s->m_len > len)s->m_off = (s->bp > s->m_pos ? s->bp - s->m_pos : s->b_size - (s->m_pos - s->bp)); s->best3[s->bp] = s->m_len; } swd_remove_node(s,s->rp); /* add bp into HEAD2 */ key = HEAD2(s->b,s->bp); s->head2[key] = s->bp; }
static void swd_findbest(ucl_swd_t * s) { ucl_uint key; ucl_uint cnt, node; ucl_uint len; assert(s->m_len > 0); /* get current head, add bp into HEAD3 */ key = HEAD3(s->b, s->bp); node = s->succ3[s->bp] = s_head3(s, key); cnt = s->llen3[key]++; assert(s->llen3[key] <= s->n + s->f); if (cnt > s->max_chain && s->max_chain > 0) cnt = s->max_chain; s->head3[key] = SWD_UINT(s->bp); s->b_char = s->b[s->bp]; len = s->m_len; if (s->m_len >= s->look) { if (s->look == 0) s->b_char = -1; s->m_off = 0; s->best3[s->bp] = SWD_UINT(s->f + 1); } else { #ifdef HEAD2 if (swd_search2(s)) #endif if (s->look >= 3) swd_search(s, node, cnt); if (s->m_len > len) s->m_off = swd_pos2off(s, s->m_pos); s->best3[s->bp] = SWD_UINT(s->m_len); #if defined(SWD_BEST_OFF) if (s->use_best_off) { int i; for (i = 2; i < SWD_BEST_OFF; i++) if (s->best_pos[i] > 0) s->best_off[i] = swd_pos2off(s, s->best_pos[i] - 1); else s->best_off[i] = 0; } #endif } swd_remove_node(s, s->rp); #ifdef HEAD2 /* add bp into HEAD2 */ key = HEAD2(s->b, s->bp); s->head2[key] = SWD_UINT(s->bp); #endif }
static void swd_findbest (lzo1x_999_swd_t * s) { lzo_uint key; lzo_uint cnt, node; lzo_uint len; key = HEAD3 (s->b, s->bp); node = s->succ3[s->bp] = s_head3 (s, key); cnt = s->llen3[key]++; if (cnt > s->max_chain && s->max_chain > 0) cnt = s->max_chain; s->head3[key] = SWD_UINT (s->bp); s->b_char = s->b[s->bp]; len = s->m_len; if (s->m_len >= s->look) { if (s->look == 0) s->b_char = -1; s->m_off = 0; s->best3[s->bp] = SWD_UINT (s->f + 1); } else { if (swd_search2 (s)) if (s->look >= 3) swd_search (s, node, cnt); if (s->m_len > len) s->m_off = swd_pos2off (s, s->m_pos); s->best3[s->bp] = SWD_UINT (s->m_len); if (s->use_best_off) { int i; for (i = 2; i < SWD_BEST_OFF; i++) if (s->best_pos[i] > 0) s->best_off[i] = swd_pos2off (s, s->best_pos[i] - 1); else s->best_off[i] = 0; } } swd_remove_node (s, s->rp); key = HEAD2 (s->b, s->bp); s->head2[key] = SWD_UINT (s->bp); }