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_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 int find_match(lzo1x_999_t *c, lzo_swd_p s, unsigned this_len, unsigned skip) { assert(c->init); if (skip > 0) { assert(this_len >= skip); swd_accept(s, this_len - skip); } else { assert(this_len <= 1); } s->m_len = 1; s->m_len = 1; #ifdef SWD_BEST_OFF if (s->use_best_off) memset(s->best_pos, 0, sizeof(s->best_pos)); #endif swd_findbest(s); c->m_len = s->m_len; c->m_off = s->m_off; swd_getbyte(s); if (s->b_char < 0) { c->look = 0; c->m_len = 0; } else { c->look = s->look + 1; } c->bp = c->ip - c->look; return LZO_E_OK; }
static void find_match(UCL_COMPRESS_DATA *c, ucl_swd_t *s, DWORD this_len, DWORD skip) { if(skip > 0) { swd_accept(s, this_len - skip); c->textsize += this_len - skip + 1; } else c->textsize += this_len - skip; s->m_len = 1; swd_findbest(s); c->m_len = s->m_len; c->m_off = s->m_off; swd_getbyte(s); if(s->b_char < 0) { c->look = 0; c->m_len = 0; swd_exit(s); } else c->look = s->look + 1; c->bp = c->ip - c->look; if(c->pCallback && c->textsize > c->printcount) { (*c->pCallback->callback)(c->textsize, c->codesize, 3, c->pCallback->pData); c->printcount += 1024; } }
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 int find_match (lzo1x_999_t * c, lzo1x_999_swd_t * s, lzo_uint this_len, lzo_uint skip) { if (skip > 0) { swd_accept (s, this_len - skip); c->textsize += this_len - skip + 1; } else { c->textsize += this_len - skip; } s->m_len = 1; s->m_len = 1; if (s->use_best_off) memset (s->best_pos, 0, sizeof (s->best_pos)); swd_findbest (s); c->m_len = s->m_len; c->m_off = s->m_off; swd_getbyte (s); if (s->b_char < 0) { c->look = 0; c->m_len = 0; } else { c->look = s->look + 1; } c->bp = c->ip - c->look; if (c->cb && c->textsize > c->printcount) { (*c->cb) (c->textsize, c->codesize); c->printcount += 1024; } return LZO_E_OK; }
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); } }
tINT find_match (tUCL_COMPRESS_CTX* c, tUCL_SWD* s, tUINT this_len, tUINT skip) { if (skip > 0) { swd_accept(s, this_len - skip); c->textsize += this_len - skip + 1; } else { c->textsize += this_len - skip; } s->m_len = THRESHOLD; swd_findbest(s); c->m_len = s->m_len; c->m_off = s->m_off; swd_getbyte(s); if (s->b_char < 0) { c->look = 0; c->m_len = 0; // swd_exit(s); } else { c->look = s->look + 1; } c->bp = c->ip - c->look; if (c->cb && c->textsize > c->printcount) { (*c->cb->CallBack)(c->textsize,c->codesize,3,c->cb->User); c->printcount += 1024; } return UCL_E_OK; }
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 int find_match ( struct ucl_compress *c, struct ucl_swd *s, unsigned int this_len, unsigned int skip ) { assert(c->init); if (skip > 0) { assert(this_len >= skip); swd_accept(s, this_len - skip); c->textsize += this_len - skip + 1; } else { assert(this_len <= 1); c->textsize += this_len - skip; } s->m_len = THRESHOLD; #ifdef SWD_BEST_OFF if (s->use_best_off) memset(s->best_pos,0,sizeof(s->best_pos)); #endif swd_findbest(s); c->m_len = s->m_len; c->m_off = s->m_off; swd_getbyte(s); if (s->b_char < 0) { c->look = 0; c->m_len = 0; swd_exit(s); } else { c->look = s->look + 1; } c->bp = c->ip - c->look; #if 0 /* brute force match search */ if (c->m_len > THRESHOLD && c->m_len + 1 <= c->look) { const uint8_t *ip = c->bp; const uint8_t *m = c->bp - c->m_off; const uint8_t *in = c->in; if (ip - in > N) in = ip - N; for (;;) { while (*in != *ip) in++; if (in == ip) break; if (in != m) if (memcmp(in,ip,c->m_len+1) == 0) printf("%p %p %p %5d\n",in,ip,m,c->m_len); in++; } } #endif return UCL_E_OK; }
static int find_match(UCL_COMPRESS_T * c, ucl_swd_t * s, ucl_uint this_len, ucl_uint skip) { assert(c->init); if (skip > 0) { assert(this_len >= skip); swd_accept(s, this_len - skip); c->textsize += this_len - skip + 1; } else { assert(this_len <= 1); c->textsize += this_len - skip; } s->m_len = THRESHOLD; #ifdef SWD_BEST_OFF if (s->use_best_off) memset(s->best_pos, 0, sizeof(s->best_pos)); #endif swd_findbest(s); c->m_len = s->m_len; #if defined(__UCL_CHECKER) /* s->m_off may be uninitialized if we didn't find a match, * but then its value will never be used. */ c->m_off = (s->m_len == THRESHOLD) ? 0 : s->m_off; #else c->m_off = s->m_off; #endif swd_getbyte(s); if (s->b_char < 0) { c->look = 0; c->m_len = 0; swd_exit(s); } else { c->look = s->look + 1; } c->bp = c->ip - c->look; #if 0 /* brute force match search */ if (c->m_len > THRESHOLD && c->m_len + 1 <= c->look) { const ucl_byte *ip = c->bp; const ucl_byte *m = c->bp - c->m_off; const ucl_byte *in = c->in; if (ip - in > N) in = ip - N; for (;;) { while (*in != *ip) in++; if (in == ip) break; if (in != m) if (memcmp(in, ip, c->m_len + 1) == 0) printf("%p %p %p %5d\n", in, ip, m, c->m_len); in++; } } #endif if (c->cb && c->textsize > c->printcount) { (*c->cb->callback) (c->textsize, c->codesize, 3, c->cb->user); c->printcount += 1024; } return UCL_E_OK; }