bugs and perfomance cleanup.
This commit is contained in:
+5
-1
@@ -163,6 +163,10 @@ struct Rect {
|
||||
|
||||
template <typename T = void *>
|
||||
struct Pool {
|
||||
uint32_t size() const {
|
||||
return slots.size() - free_indices.size();
|
||||
}
|
||||
|
||||
T *operator[](uint64_t index) {
|
||||
if (!is_valid(index)) {
|
||||
fprintf(stderr, "Invalid pool index: %lu\n", (uint64_t)index);
|
||||
@@ -191,7 +195,7 @@ struct Pool {
|
||||
slots.push_back({});
|
||||
}
|
||||
slots[id].ptr = item;
|
||||
slots[id].refcount = 1;
|
||||
slots[id].refcount = 0;
|
||||
slots[id].alive = true;
|
||||
slots[id].generation++;
|
||||
uint64_t index = ((uint64_t)slots[id].generation << 32) | id;
|
||||
|
||||
Reference in New Issue
Block a user