fix(kcp, IDT, Heap, kernel): Various fixes, scrap broken memory allocator
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user