#ifndef BUFFER_H
#define BUFFER_H
typedef unsigned int Word;
typedef unsigned char Byte;
typedef unsigned int Bits;
typedef Bits TinySize;
typedef struct Buffer {
Byte *begin, *end, *cur;
Bits bits;
} Buffer;
int buf_read_bits(Buffer *b, Word *word, Bits bits);
void buf_read_pad(Buffer *b);
int buf_read_byte(Buffer *b, Byte *byte);
int buf_write_bits(Buffer *b, Word word, Bits bits);
void buf_write_pad(Buffer *b);
int buf_write_byte(Buffer *b, Byte byte);
#endif