mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-20 07:53:56 +08:00
version: dragonpilot v0.9.4 release date: 2023-07-05T18:59:41 dp-dev(priv) master commit: 7b0489feab40283a422d2201ef95a9cb8c06f6cd
27 lines
611 B
C
27 lines
611 B
C
#ifndef bitstream_H
|
|
#define bitstream_H
|
|
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
struct bitstream {
|
|
const uint8_t *buffer_ptr;
|
|
const uint8_t *buffer_end;
|
|
uint64_t value;
|
|
uint32_t pos;
|
|
uint32_t shift;
|
|
size_t size;
|
|
};
|
|
|
|
void bs_init(struct bitstream *bs, const uint8_t *buffer, size_t input_size);
|
|
void bs_seek(struct bitstream *bs, size_t new_pos);
|
|
uint32_t bs_get(struct bitstream *bs, int n);
|
|
uint32_t bs_peek(struct bitstream *bs, int n);
|
|
size_t bs_remain(struct bitstream *bs);
|
|
int bs_eof(struct bitstream *bs);
|
|
uint32_t bs_ue(struct bitstream *bs);
|
|
int32_t bs_se(struct bitstream *bs);
|
|
|
|
#endif
|