Add bitstream utility
This commit is contained in:
parent
2d34e143d7
commit
fa7045bf1c
3 changed files with 124 additions and 0 deletions
20
libmineziper/include/libmineziper_bitstream.h
Normal file
20
libmineziper/include/libmineziper_bitstream.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef LIBMINEZIPER_BITSTREAM_H
|
||||
#define LIBMINEZIPER_BITSTREAM_H
|
||||
|
||||
typedef struct bitstream
|
||||
{
|
||||
char *data;
|
||||
int data_size; // size of 'data' array
|
||||
int last_bit_offset; // last bit in the stream
|
||||
|
||||
int current_data_offset; // position in 'data', i.e.
|
||||
// data[current_data_offset] is current
|
||||
// reading/writing byte
|
||||
int current_bit_offset; // which bit we are currently reading/writing
|
||||
} bitstream;
|
||||
|
||||
char get_bits(bitstream *bs, unsigned int size);
|
||||
void print_bits(int x, int size);
|
||||
unsigned int reverse(unsigned int x, unsigned int numBits);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue