From 9db58da40cfcb6643412bfae25aefc0cd1077f9d Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 27 May 2024 20:45:46 +0200 Subject: MHR-23: Improve project structure, make it better. Signed-off-by: Amlal El Mahrouss --- .../CoreCxxRuntime/Sources/New+Delete.cxx | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 SDK/Libraries/CoreCxxRuntime/Sources/New+Delete.cxx (limited to 'SDK/Libraries/CoreCxxRuntime/Sources') diff --git a/SDK/Libraries/CoreCxxRuntime/Sources/New+Delete.cxx b/SDK/Libraries/CoreCxxRuntime/Sources/New+Delete.cxx new file mode 100644 index 00000000..cc59586f --- /dev/null +++ b/SDK/Libraries/CoreCxxRuntime/Sources/New+Delete.cxx @@ -0,0 +1,33 @@ +/* ------------------------------------------- + + Copyright SoftwareLabs + +------------------------------------------- */ + +#include + +typedef SizeType size_t; + +void* operator new[](size_t sz) +{ + if (sz == 0) + ++sz; + + return RtHeapAllocate(sz, kStandardAllocation); +} + +void* operator new(size_t sz) +{ + if (sz == 0) + ++sz; + + return RtHeapAllocate(sz, kArrayAllocation); +} + +void operator delete[](void* ptr) +{ + if (ptr == nullptr) + return; + + RtHeapFree(ptr); +} \ No newline at end of file -- cgit v1.2.3