flate

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

commit 00e3991660b4fd5eb4c19978c1fc3e017f59f544
parent 37a3362288c663677776c3c4cbe16411db7c81e1
Author: nsz <nszabolcs@gmail.com>
Date:   Mon, 27 Apr 2009 20:03:53 +0200

inflate_simple: comments clean up
Diffstat:
inflate_simple.c | 20++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/inflate_simple.c b/inflate_simple.c @@ -1,21 +1,21 @@ -/* no input validation and bounds check, 2x to 3x slower than optimized code */ +/* no input validation, no bounds check, 2-3x slower than optimized inflate */ typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned int uint; enum { - HuffBits = 16, /* max number of bits in a code */ - Nlit = 256, /* number of lit codes */ - Nlen = 29, /* number of len codes */ - Nlitlen = Nlit+Nlen+3, /* litlen codes + block end + 2 unused */ - Ndist = 30, /* number of distance codes */ - Nclen = 19 /* number of code length codes */ + HuffBits = 16, /* max number of bits in a code */ + Nlit = 256, /* number of lit codes */ + Nlen = 29, /* number of len codes */ + Nlitlen = Nlit + Nlen + 3, /* litlen codes + block end + 2 unused */ + Ndist = 30, /* number of distance codes */ + Nclen = 19 /* number of code length codes */ }; typedef struct { ushort count[HuffBits]; /* code length -> count */ - ushort symbol[Nlitlen]; /* symbols ordered by code length */ + ushort symbol[Nlitlen]; /* symbols ordered by code length */ } HuffTree; typedef struct { @@ -109,7 +109,7 @@ static void build_tree(HuffTree *t, const uchar *lens, int n) { t->symbol[offs[lens[i]]++] = i; } -/* get one bit from s->src stream */ +/* get one bit from stream */ static uint getbit(FlateStream *s) { uint bit; @@ -122,7 +122,7 @@ static uint getbit(FlateStream *s) { return bit; } -/* get n bits from s->src stream */ +/* get n bits from stream */ static uint getbits(FlateStream *s, int n) { uint bits = 0; int i;