flate

deflate implementation
git clone git://git.suckless.org/flate
Log | Files | Refs | README

commit e2f5daebd4435fe354b86dc67a06de9f1b248797
parent 4bcbd2534cdbdb24ab4e353ab5a83538f12780dc
Author: nsz <nszabolcs@gmail.com>
Date:   Tue,  9 Jun 2009 14:18:26 +0200

+printhuff
Diffstat:
printhuff.c | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/printhuff.c b/printhuff.c @@ -0,0 +1,20 @@ +#include <stdio.h> + +/* print huff code tree to stderr */ +void printhuff(Huff *huff) { + int i; + int sum = 0; + + fprintf(stderr, "Huff huff = {\n\t.table = {"); + for (i = 0; i < 1 << huff->nbits; i++) + fprintf(stderr, "{%d, %u},", huff->table[i].len, huff->table[i].sym); + fprintf(stderr, "},\n\t.nbits = %u\n\t.sum = %u\n\t.count = {", huff->nbits, huff->sum); + for (i = 0; i < CodeBits; i++) + fprintf(stderr, "%u,", huff->count[i]); + fprintf(stderr, "},\n\t.symbol = {"); + for (i = 0; i < CodeBits; i++) + sum += huff->count[i]; + for (i = 0; i < sum; i++) + fprintf(stderr, "%u,", huff->symbol[i]); + fprintf(stderr, "}\n};\n"); +}