all repos — mgba @ ad5cdb97a8334e218ffc7ccc8e94d84a417e36a7

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);
17void CircleBufferClear(struct CircleBuffer* buffer);
18int CircleBufferWrite8(struct CircleBuffer* buffer, int8_t value);
19int CircleBufferWrite32(struct CircleBuffer* buffer, int32_t value);
20int CircleBufferRead8(struct CircleBuffer* buffer, int8_t* value);
21int CircleBufferRead32(struct CircleBuffer* buffer, int32_t* value);
22int CircleBufferRead(struct CircleBuffer* buffer, void* output, size_t length);
23int CircleBufferDump(const struct CircleBuffer* buffer, void* output, size_t length);
24
25#endif