static void swd_accept(struct ucl_swd *s, unsigned int n) { assert(n <= s->look); if (n > 0) do { unsigned int key; swd_remove_node(s,s->rp); /* add bp into HEAD3 */ key = HEAD3(s->b,s->bp); s->succ3[s->bp] = s_head3(s,key); s->head3[key] = (unsigned int)(s->bp); s->best3[s->bp] = (unsigned int)(s->f + 1); s->llen3[key]++; assert(s->llen3[key] <= s->n); /* add bp into HEAD2 */ key = HEAD2(s->b,s->bp); s->head2[key] = (unsigned int)(s->bp); swd_getbyte(s); } while (--n > 0); }
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 __inline__ void swd_remove_node(struct ucl_swd *s, unsigned int node) { if (s->node_count == 0) { unsigned int key; #ifdef UCL_DEBUG if (s->first_rp != UINT_MAX) { if (node != s->first_rp) printf("Remove %5d: %5d %5d %5d %5d %6d %6d\n", node, s->rp, s->ip, s->bp, s->first_rp, s->ip - node, s->ip - s->bp); assert(node == s->first_rp); s->first_rp = UINT_MAX; } #endif key = HEAD3(s->b,node); assert(s->llen3[key] > 0); --s->llen3[key]; key = HEAD2(s->b,node); assert(s->head2[key] != NIL2); if ((unsigned int) s->head2[key] == node) s->head2[key] = NIL2; } else --s->node_count; }
/*********************************************************************** // ************************************************************************/ static void swd_accept(lzo_swd_p s, unsigned n) { assert(n <= s->look); while (n--) { unsigned key; swd_remove_node(s,s->rp); /* add bp into HEAD3 */ key = HEAD3(s->b, s->bp); s->succ3[s->bp] = s_get_head3(s, key); s->head3[key] = s->bp; s->best3[s->bp] = SWD_F + 1; s->llen3[key]++; assert(s->llen3[key] <= SWD_N); #ifdef HEAD2 /* add bp into HEAD2 */ key = HEAD2(s->b, s->bp); s->head2[key] = s->bp; #endif swd_getbyte(s); } }
static void swd_accept(ucl_swd_t * s, ucl_uint n) { assert(n <= s->look); if (n > 0) do { ucl_uint key; swd_remove_node(s, s->rp); /* add bp into HEAD3 */ key = HEAD3(s->b, s->bp); s->succ3[s->bp] = s_head3(s, key); s->head3[key] = SWD_UINT(s->bp); s->best3[s->bp] = SWD_UINT(s->f + 1); s->llen3[key]++; assert(s->llen3[key] <= s->n); #ifdef HEAD2 /* add bp into HEAD2 */ key = HEAD2(s->b, s->bp); s->head2[key] = SWD_UINT(s->bp); #endif swd_getbyte(s); } while (--n > 0); }
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); }
static void swd_remove_node(ucl_swd_t *s, DWORD node) { if(s->node_count == 0) { DWORD key = HEAD3(s->b, node); --s->llen3[key]; key = HEAD2(s->b,node); if((DWORD) s->head2[key] == node)s->head2[key] = NIL2; } else --s->node_count; }
/*********************************************************************** // remove node from lists ************************************************************************/ static void swd_remove_node(lzo_swd_p s, unsigned node) { if (s->node_count == 0) { unsigned key; key = HEAD3(s->b,node); assert(s->llen3[key] > 0); --s->llen3[key]; #ifdef HEAD2 key = HEAD2(s->b,node); assert(s->head2[key] != NIL2); if ((unsigned) s->head2[key] == node) s->head2[key] = NIL2; #endif } else --s->node_count; }
static __inline__ void swd_remove_node (lzo1x_999_swd_t * s, lzo_uint node) { if (s->node_count == 0) { lzo_uint key; key = HEAD3 (s->b, node); --s->llen3[key]; key = HEAD2 (s->b, node); if ((lzo_uint) s->head2[key] == node) s->head2[key] = NIL2; } else --s->node_count; }
static __inline void swd_insertdict(ucl_swd_t *s, DWORD node, DWORD len) { DWORD key; s->node_count = s->n - len; s->first_rp = node; while(len-- > 0) { key = HEAD3(s->b, node); s->succ3[node] = s->head3[key]; s->head3[key] = node; s->best3[node] = SWD_F + 1; s->llen3[key]++; key = HEAD2(s->b, node); s->head2[key] = node; node++; } }
static void swd_accept (lzo1x_999_swd_t * s, lzo_uint n) { while (n--) { lzo_uint key; swd_remove_node (s, s->rp); key = HEAD3 (s->b, s->bp); s->succ3[s->bp] = s_head3 (s, key); s->head3[key] = SWD_UINT (s->bp); s->best3[s->bp] = SWD_UINT (s->f + 1); s->llen3[key]++; key = HEAD2 (s->b, s->bp); s->head2[key] = SWD_UINT (s->bp);; swd_getbyte (s); } }
static void swd_insertdict (lzo1x_999_swd_t * s, lzo_uint node, lzo_uint len) { lzo_uint key; s->node_count = s->n - len; s->first_rp = node; while (len-- > 0) { key = HEAD3 (s->b, node); s->succ3[node] = s_head3 (s, key); s->head3[key] = SWD_UINT (node); s->best3[node] = SWD_UINT (s->f + 1); s->llen3[key]++; key = HEAD2 (s->b, node); s->head2[key] = SWD_UINT (node); node++; } }
static void swd_insertdict(struct ucl_swd *s, unsigned int node, unsigned int len) { unsigned int key; s->node_count = s->n - len; s->first_rp = node; while (len-- > 0) { key = HEAD3(s->b,node); s->succ3[node] = s_head3(s,key); s->head3[key] = (unsigned int)(node); s->best3[node] = (unsigned int)(s->f + 1); s->llen3[key]++; assert(s->llen3[key] <= s->n); key = HEAD2(s->b,node); s->head2[key] = (unsigned int)(node); node++; } }
static __inline void swd_accept(ucl_swd_t *s, DWORD n) { if(n > 0)do { DWORD key; swd_remove_node(s, s->rp); /* add bp into HEAD3 */ key = HEAD3(s->b,s->bp); s->succ3[s->bp] = s->head3[key]; s->head3[key] = s->bp; s->best3[s->bp] = SWD_F + 1; s->llen3[key]++; key = HEAD2(s->b, s->bp); s->head2[key] = s->bp; swd_getbyte(s); } while(--n > 0); }
static void swd_insertdict(ucl_swd_t * s, ucl_uint node, ucl_uint len) { ucl_uint key; s->node_count = s->n - len; s->first_rp = node; while (len-- > 0) { key = HEAD3(s->b, node); s->succ3[node] = s_head3(s, key); s->head3[key] = SWD_UINT(node); s->best3[node] = SWD_UINT(s->f + 1); s->llen3[key]++; assert(s->llen3[key] <= s->n); #ifdef HEAD2 key = HEAD2(s->b, node); s->head2[key] = SWD_UINT(node); #endif node++; } }