fix(kcp, IDT, Heap, kernel): Various fixes, scrap broken memory allocator

This commit is contained in:
Daniel Hammer
2025-03-11 20:00:04 +01:00
parent b774f82625
commit cc094a9172
23 changed files with 18910 additions and 195 deletions
+10 -5
View File
@@ -6,7 +6,7 @@
#pragma once
#include <cstdint>
#include <Terminal/terminal.hpp>
#include <Terminal/Terminal.hpp>
#include <Memory/Heap.hpp>
namespace kcp
@@ -24,11 +24,12 @@ namespace kcp
array = nullptr;
}
T operator[](std::size_t position)
T& operator[](std::size_t position)
{
if (position > (sz - 1)) {
kerr << "Vector out of bounds caught!" << Kt::newline;
return T{};
return at(0);
}
else
{
@@ -36,13 +37,17 @@ namespace kcp
}
}
T at(std::int64_t position) {
T& at(std::int64_t position) {
return this->operator[](position);
}
void push_back(T value) {
size_t push_back(T value) {
size_t _sz = sz;
array = (T *)Memory::g_heap->Realloc(array, sizeof(T) * (sz + 1));
array[sz++] = value;
return _sz;
}
T* get_array()