all repos — mgba @ daaa2fa5236df5e8976e7e0ba7ac39e0d9233422

mGBA Game Boy Advance Emulator

src/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 "util/common.h"
10
11struct RingFIFO {
12	void* data;
13	size_t capacity;
14	void* readPtr;
15	void* writePtr;
16};
17
18void RingFIFOInit(struct RingFIFO* buffer, size_t capacity);
19void RingFIFODeinit(struct RingFIFO* buffer);
20size_t RingFIFOCapacity(const struct RingFIFO* buffer);
21void RingFIFOClear(struct RingFIFO* buffer);
22size_t RingFIFOWrite(struct RingFIFO* buffer, const void* value, size_t length);
23size_t RingFIFORead(struct RingFIFO* buffer, void* output, size_t length);
24
25#endif