Updated kernel (tl;dr: improved filesystem, tasking, loading files, etc..)

This commit is contained in:
Alex
2023-02-06 19:35:44 +02:00
parent 640f6a412a
commit a592b85ce5
46 changed files with 3503 additions and 2412 deletions

View File

@ -1,5 +1,7 @@
#pragma once
#define HASHMAP_ERROR -0x8A50
template <typename K, typename V>
class HashNode
{
@ -33,6 +35,15 @@ public:
DummyNode = new HashNode<K, V>(-1, -1);
}
~HashMap()
{
for (int i = 0; i < HashMapCapacity; i++)
if (Nodes[i] != nullptr)
delete Nodes[i];
delete[] Nodes;
delete DummyNode;
}
int HashCode(K Key) { return Key % HashMapCapacity; }
void AddNode(K Key, V Value)
@ -67,7 +78,7 @@ public:
Index++;
Index %= HashMapCapacity;
}
return 0xdeadbeef;
return HASHMAP_ERROR;
}
V Get(int Key)
@ -78,14 +89,14 @@ public:
while (Nodes[Index] != nullptr)
{
if (Iterate++ > HashMapCapacity)
return 0xdeadbeef;
return HASHMAP_ERROR;
if (Nodes[Index]->Key == (K)Key)
return Nodes[Index]->Value;
Index++;
Index %= HashMapCapacity;
}
return 0xdeadbeef;
return HASHMAP_ERROR;
}
int Size() { return HashMapSize; }