all repos — mgba @ 6bf0e704d2233518aaade380d86d3143530a75fc

mGBA Game Boy Advance Emulator

src/util/circle-buffer.h (view raw)

 1#ifndef CIRCLE_BUFFER_H
 2#define CIRCLE_BUFFER_H
 3
 4#include "common.h"
 5
 6struct CircleBuffer {
 7	void* data;
 8	unsigned capacity;
 9	unsigned size;
10	void* readPtr;
11	void* writePtr;
12};
13
14void CircleBufferInit(struct CircleBuffer* buffer, unsigned capacity);
15void CircleBufferDeinit(struct CircleBuffer* buffer);
16unsigned CircleBufferSize(const struct CircleBuffer* buffer);
17int CircleBufferWrite8(struct CircleBuffer* buffer, int8_t value);
18int CircleBufferWrite32(struct CircleBuffer* buffer, int32_t value);
19int CircleBufferRead8(struct CircleBuffer* buffer, int8_t* value);
20int CircleBufferRead32(struct CircleBuffer* buffer, int32_t* value);
21int CircleBufferRead(struct CircleBuffer* buffer, void* output, size_t length);
22
23#endif