diff options
author | Leo Howell <leo@lwh.jp> | 2009-09-05 09:33:22 +0900 |
---|---|---|
committer | Leo Howell <leo@lwh.jp> | 2009-09-05 09:33:22 +0900 |
commit | ef01767c732629b7eff7d1601e76a1bac58f5bfd (patch) | |
tree | ac29871fd3c6f1bab8dc8e3c51e33292d5544a96 /lpg/libqr/bitstream.h | |
download | pdf-simple-sign-ef01767c732629b7eff7d1601e76a1bac58f5bfd.tar.gz pdf-simple-sign-ef01767c732629b7eff7d1601e76a1bac58f5bfd.tar.xz pdf-simple-sign-ef01767c732629b7eff7d1601e76a1bac58f5bfd.zip |
The story so far
Diffstat (limited to 'lpg/libqr/bitstream.h')
-rw-r--r-- | lpg/libqr/bitstream.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lpg/libqr/bitstream.h b/lpg/libqr/bitstream.h new file mode 100644 index 0000000..12412bc --- /dev/null +++ b/lpg/libqr/bitstream.h @@ -0,0 +1,44 @@ +#ifndef QR_BITSTREAM_H +#define QR_BITSTREAM_H + +#include <stddef.h> + +/** + * Note: when writing / reading multiple bits, the + * _most_ significant bits come first in the stream. + * (That is, the order you would naturally write the + * number in binary) + */ + +struct bitstream; + +struct bitstream * bitstream_create(void); +int bitstream_resize(struct bitstream *, size_t bits); +void bitstream_destroy(struct bitstream *); +struct bitstream * bitstream_copy(const struct bitstream *); + +void bitstream_seek(struct bitstream *, size_t pos); +size_t bitstream_tell(const struct bitstream *); +size_t bitstream_remaining(const struct bitstream *); +size_t bitstream_size(const struct bitstream *); + +unsigned int bitstream_read(struct bitstream *, size_t bits); + +void bitstream_unpack(struct bitstream *, + unsigned int * result, + size_t count, + size_t bitsize); + +int bitstream_write(struct bitstream *, + unsigned int value, + size_t bits); + +int bitstream_pack(struct bitstream *, + const unsigned int * values, + size_t count, + size_t bitsize); + +int bitstream_cat(struct bitstream *, const struct bitstream * src); + +#endif + |