mirror of
https://github.com/CDevJoud/Minecraft-Community-Edition.git
synced 2026-07-16 07:40:51 +00:00
It should been included from the begining
This commit is contained in:
32
Minecraft-Community-Edition/Core/eastl_allocator.cpp
Normal file
32
Minecraft-Community-Edition/Core/eastl_allocator.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <new>
|
||||
|
||||
// Delete corresponding to:
|
||||
// void* operator new[](size_t size, const char* name, int flags, unsigned debugFlags, const char* file, int line)
|
||||
void __cdecl operator delete[](void* p, const char* name, int flags, unsigned debugFlags, const char* file, int line) noexcept {
|
||||
delete[] static_cast<uint8_t*>(p);
|
||||
}
|
||||
|
||||
// Delete corresponding to:
|
||||
// void* operator new[](uint64_t size, uint64_t alignment, uint64_t offset, const char* pName, int flags, unsigned debugFlags, const char* file, int line)
|
||||
void __cdecl operator delete[](void* p, unsigned __int64 size, unsigned __int64 alignment, unsigned __int64 offset, const char* pName, int flags, unsigned debugFlags, const char* file, int line) noexcept {
|
||||
delete[] static_cast<uint8_t*>(p);
|
||||
}
|
||||
|
||||
// You should also provide normal delete[] to match standard usage
|
||||
void __cdecl operator delete[](void* p) noexcept {
|
||||
if (p != nullptr) {
|
||||
std::free(p);
|
||||
p = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void* __cdecl operator new[](size_t size, const char* name, int flags, unsigned debugFlags, const char* file, int line) {
|
||||
return new uint8_t[size];
|
||||
}
|
||||
|
||||
void* __cdecl operator new[](unsigned __int64 size, unsigned __int64 alignment, unsigned __int64 offset, char const* pName, int flags, unsigned int debugFlags, char const* file, int line) {
|
||||
|
||||
return new uint8_t[size];
|
||||
}
|
||||
Reference in New Issue
Block a user