lzw.h

来自「基于LWIP的服务器」· C头文件 代码 · 共 31 行

H
31
字号
#define INIT_BITS 9
#define MAX_BITS  13         /* Do not exceed 14 with this program */
#define HASHING_SHIFT MAX_BITS - 8

//#if MAX_BITS == 14            /* Set the table size. Must be a prime    */
//#define TABLE_SIZE 18041      /* number somewhat larger than 2^MAX_BITS.*/
//#elif MAX_BITS == 13
#define TABLE_SIZE 9029
//#else
//#define TABLE_SIZE 2021  //5021
//#endif

#define CLEAR_TABLE 256    /* Code to flush the string table */
#define TERMINATOR  257    /* To mark EOF Condition, instead of MAX_VALUE */
#define FIRST_CODE  258    /* First available code for code_value table */
#define CHECK_TIME  100    /* Check comp ratio every CHECK_TIME chars input */

#define MAXVAL(n) (( 1 <<( n )) -1)   /* max_value formula macro */

unsigned input_code();
void *malloc();



void compress(FILE *input, FILE *output);
unsigned int find_match(int hash_prefix, unsigned int hash_character);
void expand(FILE *input, FILE *output);
unsigned char *decode_string(unsigned char *buffer, unsigned int code);
unsigned input_code(FILE *input);
void output_code(FILE *output, unsigned int code);
int MakeLzwFile(const char *file);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?