libdragon
Loading...
Searching...
No Matches
ringbuf_internal.h
1#ifndef LIBDRAGON_COMPRESS_RINGBUF_INTERNAL_H
2#define LIBDRAGON_COMPRESS_RINGBUF_INTERNAL_H
3
4#include <stdint.h>
5
9typedef struct {
10 uint8_t* ringbuf;
11 unsigned int ringbuf_size;
12 unsigned int ringbuf_pos;
14
15
16void __ringbuf_init(decompress_ringbuf_t *ringbuf, uint8_t *buf, int winsize);
17
18static inline void __ringbuf_writebyte(decompress_ringbuf_t *ringbuf, uint8_t byte)
19{
20 ringbuf->ringbuf[ringbuf->ringbuf_pos++] = byte;
21 ringbuf->ringbuf_pos &= ringbuf->ringbuf_size-1;
22}
23
31void __ringbuf_write(decompress_ringbuf_t *ringbuf, uint8_t *src, int count);
32
50void __ringbuf_copy(decompress_ringbuf_t *ringbuf, int copy_offset, uint8_t *dst, int count);
51
52#endif
A ring buffer used for streaming decompression.
Definition ringbuf_internal.h:9
unsigned int ringbuf_size
Size of the ring buffer (power of two)
Definition ringbuf_internal.h:11
uint8_t * ringbuf
The ring buffer itself.
Definition ringbuf_internal.h:10
unsigned int ringbuf_pos
Current write position in the ring buffer.
Definition ringbuf_internal.h:12