diff options
author | Leo Howell <leo@lwh.jp> | 2009-09-27 16:53:16 +0900 |
---|---|---|
committer | Leo Howell <leo@lwh.jp> | 2009-09-27 16:53:16 +0900 |
commit | 388507a61df32c0bddf7e61c5da013c3f29d32d4 (patch) | |
tree | 3319b13ff5c0cb8398393519c8c531599735b5f4 /lpg/libqr/qr-bitstream.h | |
parent | 559eb9633e1f97d70112f02538ae5e9a0e46f4d5 (diff) | |
download | pdf-simple-sign-388507a61df32c0bddf7e61c5da013c3f29d32d4.tar.gz pdf-simple-sign-388507a61df32c0bddf7e61c5da013c3f29d32d4.tar.xz pdf-simple-sign-388507a61df32c0bddf7e61c5da013c3f29d32d4.zip |
bitstream -> qr_bitstream
Diffstat (limited to 'lpg/libqr/qr-bitstream.h')
-rw-r--r-- | lpg/libqr/qr-bitstream.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lpg/libqr/qr-bitstream.h b/lpg/libqr/qr-bitstream.h new file mode 100644 index 0000000..298e53b --- /dev/null +++ b/lpg/libqr/qr-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 qr_bitstream; + +struct qr_bitstream * qr_bitstream_create(void); +int qr_bitstream_resize(struct qr_bitstream *, size_t bits); +void qr_bitstream_destroy(struct qr_bitstream *); +struct qr_bitstream * qr_bitstream_copy(const struct qr_bitstream *); + +void qr_bitstream_seek(struct qr_bitstream *, size_t pos); +size_t qr_bitstream_tell(const struct qr_bitstream *); +size_t qr_bitstream_remaining(const struct qr_bitstream *); +size_t qr_bitstream_size(const struct qr_bitstream *); + +unsigned int qr_bitstream_read(struct qr_bitstream *, size_t bits); + +void qr_bitstream_unpack(struct qr_bitstream *, + unsigned int * result, + size_t count, + size_t bitsize); + +int qr_bitstream_write(struct qr_bitstream *, + unsigned int value, + size_t bits); + +int qr_bitstream_pack(struct qr_bitstream *, + const unsigned int * values, + size_t count, + size_t bitsize); + +int qr_bitstream_cat(struct qr_bitstream *, const struct qr_bitstream * src); + +#endif + |