RetroArch
bitstream.h
Go to the documentation of this file.
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 */
24 struct 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 
33 struct bitstream* create_bitstream(const void *src, uint32_t srclength);
36 
37 uint32_t bitstream_read(struct bitstream* bitstream, int numbits);
38 uint32_t bitstream_peek(struct bitstream* bitstream, int numbits);
39 void bitstream_remove(struct bitstream* bitstream, int numbits);
41 
42 
43 #endif
void bitstream_remove(struct bitstream *bitstream, int numbits)
Definition: libchdr_bitstream.c:72
uint32_t buffer
Definition: bitstream.h:26
Definition: bitstream.h:24
GLenum src
Definition: glext.h:6980
uint32_t bitstream_read(struct bitstream *bitstream, int numbits)
Definition: libchdr_bitstream.c:84
const uint8_t * read
Definition: bitstream.h:28
uint32_t bitstream_flush(struct bitstream *bitstream)
Definition: libchdr_bitstream.c:115
uint32_t bitstream_peek(struct bitstream *bitstream, int numbits)
Definition: libchdr_bitstream.c:44
struct bitstream * create_bitstream(const void *src, uint32_t srclength)
Definition: libchdr_bitstream.c:26
uint32_t doffset
Definition: bitstream.h:29
uint32_t bitstream_read_offset(struct bitstream *bitstream)
Definition: libchdr_bitstream.c:97
int bits
Definition: bitstream.h:27
int bitstream_overflow(struct bitstream *bitstream)
Definition: libchdr_bitstream.c:19
uint32_t dlength
Definition: bitstream.h:30
unsigned char uint8_t
Definition: stdint.h:124
unsigned int uint32_t
Definition: stdint.h:126