Update libchdr (replace libflac with dr_flac)
[pcsx_rearmed.git] / deps / libchdr / include / libchdr / bitstream.h
CommitLineData
9c659ffe 1/* license:BSD-3-Clause
2 * copyright-holders:Aaron Giles
3***************************************************************************
4
5 bitstream.h
6
7 Helper classes for reading/writing at the bit level.
8
9***************************************************************************/
10
11#pragma once
12
13#ifndef __BITSTREAM_H__
14#define __BITSTREAM_H__
15
16#include <stdint.h>
17
18/***************************************************************************
19 * TYPE DEFINITIONS
20 ***************************************************************************
21 */
22
23/* helper class for reading from a bit buffer */
24struct bitstream
25{
26 uint32_t buffer; /* current bit accumulator */
27 int bits; /* number of bits in the accumulator */
28 const uint8_t * read; /* read pointer */
29 uint32_t doffset; /* byte offset within the data */
30 uint32_t dlength; /* length of the data */
31};
32
33struct bitstream* create_bitstream(const void *src, uint32_t srclength);
34int bitstream_overflow(struct bitstream* bitstream);
35uint32_t bitstream_read_offset(struct bitstream* bitstream);
36
37uint32_t bitstream_read(struct bitstream* bitstream, int numbits);
38uint32_t bitstream_peek(struct bitstream* bitstream, int numbits);
39void bitstream_remove(struct bitstream* bitstream, int numbits);
40uint32_t bitstream_flush(struct bitstream* bitstream);
41
42
43#endif