-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
|
||
// these symbols need to live in the global namespace. | ||
|
||
#include <memory> | ||
#include <Allocator.hpp> | ||
|
||
namespace TiltedPhoques | ||
{ | ||
inline void* TPAlloc(const size_t acSize) | ||
{ | ||
return TiltedPhoques::Allocator::Get()->Allocate(acSize); | ||
} | ||
|
||
inline void TPFree(void* apBlock) | ||
{ | ||
TiltedPhoques::Allocator::Get()->Free(apBlock); | ||
} | ||
} | ||
|
||
// NOTE(Force): this replaces the global c++ operators, note that this is transitive, e.g. | ||
// it replaces the symbols for all projects. | ||
#ifdef TPCORE_CXX_ALLOCATOR_OVERRIDE | ||
|
||
void* operator new(size_t size) | ||
{ | ||
return TiltedPhoques::TPAlloc(size); | ||
} | ||
|
||
void operator delete(void* p) noexcept | ||
{ | ||
TiltedPhoques::TPFree(p); | ||
} | ||
|
||
void* operator new[](size_t size) | ||
{ | ||
return TiltedPhoques::TPAlloc(size); | ||
} | ||
|
||
void operator delete[](void* p) noexcept | ||
{ | ||
TiltedPhoques::TPFree(p); | ||
} | ||
|
||
void* operator new(size_t size, const std::nothrow_t&) noexcept | ||
{ | ||
return TiltedPhoques::TPAlloc(size); | ||
} | ||
|
||
void* operator new[](size_t size, const std::nothrow_t&) noexcept | ||
{ | ||
return TiltedPhoques::TPAlloc(size); | ||
} | ||
|
||
void operator delete(void* p, const std::nothrow_t&) noexcept | ||
{ | ||
TiltedPhoques::TPFree(p); | ||
} | ||
|
||
void operator delete[](void* p, const std::nothrow_t&) noexcept | ||
{ | ||
TiltedPhoques::TPFree(p); | ||
} | ||
|
||
void operator delete(void* p, size_t) noexcept | ||
{ | ||
TiltedPhoques::TPFree(p); | ||
} | ||
|
||
void operator delete[](void* p, size_t) noexcept | ||
{ | ||
TiltedPhoques::TPFree(p); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@echo off | ||
|
||
xmake project -k vsxmake2022 | ||
timeout /t 3 /nobreak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters