prime/include/Kyoto/Alloc/CCircularBuffer.hpp

25 lines
518 B
C++
Raw Normal View History

2022-09-11 05:54:54 +00:00
#ifndef __CCIRCULARBUFFER_HPP__
#define __CCIRCULARBUFFER_HPP__
#include <types.h>
class CCircularBuffer {
public:
2022-09-18 06:05:46 +00:00
enum EOwnership { kOS_Owned, kOS_NotOwned };
CCircularBuffer(void* buf, int len, EOwnership owned = kOS_NotOwned);
bool IsWrappedMemory(int offset, int len);
void* Alloc(int len);
void Free(void* ptr, int len);
int GetAllocatedAmount() const;
2022-09-11 05:54:54 +00:00
private:
2022-09-18 06:05:46 +00:00
u8 x0_owned;
void* x4_ptr;
s32 x8_bufferLen;
s32 xc_;
s32 x10_nextFreeAddr;
s32 x14_;
2022-09-11 05:54:54 +00:00
};
#endif // __CCIRCULARBUFFER_HPP__