aboutsummaryrefslogtreecommitdiff
path: root/deps/libchdr/include/libchdr/bitstream.h
diff options
context:
space:
mode:
authorjdgleaver2021-03-15 15:36:34 +0000
committerjdgleaver2021-03-15 15:36:34 +0000
commit2ff0b5124f2e17a290121e1eeecf45db1d9e2c85 (patch)
tree3cf574af74146252926490c2816d95e34a602a3c /deps/libchdr/include/libchdr/bitstream.h
parente3e1b865f7c06f57918b97f7293b5b2959fb7b7d (diff)
downloadpcsx_rearmed-2ff0b5124f2e17a290121e1eeecf45db1d9e2c85.tar.gz
pcsx_rearmed-2ff0b5124f2e17a290121e1eeecf45db1d9e2c85.tar.bz2
pcsx_rearmed-2ff0b5124f2e17a290121e1eeecf45db1d9e2c85.zip
Update libchdr (replace libflac with dr_flac)
Diffstat (limited to 'deps/libchdr/include/libchdr/bitstream.h')
-rw-r--r--deps/libchdr/include/libchdr/bitstream.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/deps/libchdr/include/libchdr/bitstream.h b/deps/libchdr/include/libchdr/bitstream.h
new file mode 100644
index 0000000..d376373
--- /dev/null
+++ b/deps/libchdr/include/libchdr/bitstream.h
@@ -0,0 +1,43 @@
+/* license:BSD-3-Clause
+ * copyright-holders:Aaron Giles
+***************************************************************************
+
+ bitstream.h
+
+ Helper classes for reading/writing at the bit level.
+
+***************************************************************************/
+
+#pragma once
+
+#ifndef __BITSTREAM_H__
+#define __BITSTREAM_H__
+
+#include <stdint.h>
+
+/***************************************************************************
+ * TYPE DEFINITIONS
+ ***************************************************************************
+ */
+
+/* helper class for reading from a bit buffer */
+struct bitstream
+{
+ uint32_t buffer; /* current bit accumulator */
+ int bits; /* number of bits in the accumulator */
+ const uint8_t * read; /* read pointer */
+ uint32_t doffset; /* byte offset within the data */
+ uint32_t dlength; /* length of the data */
+};
+
+struct bitstream* create_bitstream(const void *src, uint32_t srclength);
+int bitstream_overflow(struct bitstream* bitstream);
+uint32_t bitstream_read_offset(struct bitstream* bitstream);
+
+uint32_t bitstream_read(struct bitstream* bitstream, int numbits);
+uint32_t bitstream_peek(struct bitstream* bitstream, int numbits);
+void bitstream_remove(struct bitstream* bitstream, int numbits);
+uint32_t bitstream_flush(struct bitstream* bitstream);
+
+
+#endif