mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-25 00:23:04 -06:00
Merge pull request #61 from lioncash/kernel-stuff
Core: Use std::array for managing kernel object space
This commit is contained in:
commit
0db986d92a
2 changed files with 5 additions and 5 deletions
|
@ -17,7 +17,6 @@ Handle g_main_thread = 0;
|
||||||
ObjectPool g_object_pool;
|
ObjectPool g_object_pool;
|
||||||
|
|
||||||
ObjectPool::ObjectPool() {
|
ObjectPool::ObjectPool() {
|
||||||
memset(occupied, 0, sizeof(bool) * MAX_COUNT);
|
|
||||||
next_id = INITIAL_NEXT_ID;
|
next_id = INITIAL_NEXT_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +56,7 @@ void ObjectPool::Clear() {
|
||||||
delete pool[i];
|
delete pool[i];
|
||||||
occupied[i] = false;
|
occupied[i] = false;
|
||||||
}
|
}
|
||||||
memset(pool, 0, sizeof(Object*)*MAX_COUNT);
|
pool.fill(nullptr);
|
||||||
next_id = INITIAL_NEXT_ID;
|
next_id = INITIAL_NEXT_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
|
|
||||||
|
@ -160,9 +161,9 @@ private:
|
||||||
INITIAL_NEXT_ID = 0x10,
|
INITIAL_NEXT_ID = 0x10,
|
||||||
};
|
};
|
||||||
|
|
||||||
Object* pool[MAX_COUNT];
|
std::array<Object*, MAX_COUNT> pool;
|
||||||
bool occupied[MAX_COUNT];
|
std::array<bool, MAX_COUNT> occupied;
|
||||||
int next_id;
|
int next_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ObjectPool g_object_pool;
|
extern ObjectPool g_object_pool;
|
||||||
|
|
Loading…
Reference in a new issue