all repos — mgba @ fa884d071ecaa3e05ff20b45a67bf9500dd3d6b6

mGBA Game Boy Advance Emulator

include/mgba-util/ring-fifo.h (view raw)

 1/* Copyright (c) 2013-2014 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef RING_FIFO_H
 7#define RING_FIFO_H
 8
 9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13struct RingFIFO {
14	void* data;
15	size_t capacity;
16	void* readPtr;
17	void* writePtr;
18};
19
20void RingFIFOInit(struct RingFIFO* buffer, size_t capacity);
21void RingFIFODeinit(struct RingFIFO* buffer);
22size_t RingFIFOCapacity(const struct RingFIFO* buffer);
23void RingFIFOClear(struct RingFIFO* buffer);
24size_t RingFIFOWrite(struct RingFIFO* buffer, const void* value, size_t length);
25size_t RingFIFORead(struct RingFIFO* buffer, void* output, size_t length);
26
27CXX_GUARD_END
28
29#endif