summaryrefslogtreecommitdiffhomepage
path: root/SDK/Libraries/CoreCxxRuntime/Sources
diff options
context:
space:
mode:
Diffstat (limited to 'SDK/Libraries/CoreCxxRuntime/Sources')
-rw-r--r--SDK/Libraries/CoreCxxRuntime/Sources/New+Delete.cxx33
1 files changed, 33 insertions, 0 deletions
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 <Headers/Heap.h>
+
+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