; out->by_left -= 8;
}
}
//------------------------------------------------------------------------------
VOID do_encode( PBUFFER_DATA in, PBUFFER_DATA out, PLZW_DATA lzw)
{
WORD prefix;
while( in->index != in->top )
{
if( !in_table(lzw) )
{
// current code not in code table
// then add it to table and output prefix
insert_table(lzw);
prefix = lzw->suffix;
output_code( lzw->prefix ,out ,lzw );
lzw->code++;
if( lzw->code == (WORD)1<< lzw->cur_code_len )
{
// code reached current code top(1<<cur_code_len)
// then current code length add one
lzw->cur_code_len++;
if( lzw->cur_code_len == CODE_LEN + 1 )
{
re_init_lzw( lzw );
}
}
}
else
{
// current code already in code table
// then output nothing
prefix = get_code(lzw);
}
lzw->prefix = prefix;
lzw->suffix = in->lp_buffer[ in->index++ ];
}
}
//------------------------------------------------------------------------------
VOID encode(