2019-12-22 20:04:07 +00:00
|
|
|
#include "Runtime/CGameAllocator.hpp"
|
2020-09-08 17:58:55 +00:00
|
|
|
#include <new>
|
2017-09-12 15:27:48 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
|
|
|
logvisor::Module AllocLog("metaforce::CGameAllocator");
|
2017-09-12 15:27:48 +00:00
|
|
|
|
2019-06-12 02:05:17 +00:00
|
|
|
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
|
|
|
|
2020-09-08 17:58:55 +00:00
|
|
|
u32 CGameAllocator::GetFreeBinEntryForSize(size_t len) {
|
|
|
|
size_t bin = 0;
|
|
|
|
size_t binSize = 32;
|
|
|
|
while (true) {
|
|
|
|
if (binSize > 0x200000) {
|
|
|
|
return 15;
|
|
|
|
}
|
|
|
|
if (len < binSize) {
|
|
|
|
break;
|
2017-09-12 15:27:48 +00:00
|
|
|
}
|
2020-09-08 17:58:55 +00:00
|
|
|
binSize <<= 1;
|
|
|
|
++bin;
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2020-09-08 17:58:55 +00:00
|
|
|
return bin;
|
2017-09-12 15:27:48 +00:00
|
|
|
}
|
|
|
|
|
2020-09-08 17:58:55 +00:00
|
|
|
bool CGameAllocator::Initialize() { return true; }
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|