summaryrefslogtreecommitdiffhomepage
path: root/Public/Kits/System.Core/Heap.cxx
diff options
context:
space:
mode:
authoramlal <amlal@el-mahrouss-logic.com>2024-03-16 14:22:21 +0100
committeramlal <amlal@el-mahrouss-logic.com>2024-03-16 14:22:21 +0100
commit55059428bfd6a18451bc1ed3ee64e7bb04c395cd (patch)
tree02dd524a2249111e30d2208fd700fa72e31182db /Public/Kits/System.Core/Heap.cxx
parent8f9b5e08f53f6e49a1f4c6b20e17c54298da9c44 (diff)
HCR-14: See below.
- Pretty big modifications, add kernel mouse. Signed-off-by: amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Public/Kits/System.Core/Heap.cxx')
-rw-r--r--Public/Kits/System.Core/Heap.cxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/Public/Kits/System.Core/Heap.cxx b/Public/Kits/System.Core/Heap.cxx
new file mode 100644
index 00000000..c7401aad
--- /dev/null
+++ b/Public/Kits/System.Core/Heap.cxx
@@ -0,0 +1,38 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#include <System.Core/Heap.hxx>
+#include <System.Core/System.Core.hxx>
+
+using namespace HCore;
+using namespace System;
+
+STATIC HcObjectPtr kObjectHeap;
+
+Heap* Heap::Shared() noexcept {
+ static Heap* heap = nullptr;
+
+ if (!heap) {
+ heap = new Heap();
+ kObjectHeap = HcGetProcessHeap();
+ }
+
+ return heap;
+}
+
+void Heap::Delete(HeapPtr me) noexcept { HcFreeProcessHeap(kObjectHeap, me); }
+
+SizeT Heap::Size(HeapPtr me) noexcept {
+ CA_MUST_PASS(me);
+ return HcProcessHeapSize(kObjectHeap, me);
+}
+
+HeapPtr Heap::New(const SizeT &sz, const Int32 flags) {
+ SizeT _sz = sz;
+ if (!_sz) ++_sz;
+
+ return HcAllocateProcessHeap(kObjectHeap, _sz, flags);
+} \ No newline at end of file