|
@@ -292,43 +292,32 @@ public:
|
|
|
_FORCE_INLINE_ uint32_t get_rid_count() const {
|
|
|
return alloc_count;
|
|
|
}
|
|
|
-
|
|
|
- _FORCE_INLINE_ T *get_ptr_by_index(uint32_t p_index) {
|
|
|
- ERR_FAIL_UNSIGNED_INDEX_V(p_index, alloc_count, nullptr);
|
|
|
+ void get_owned_list(List<RID> *p_owned) {
|
|
|
if (THREAD_SAFE) {
|
|
|
spin_lock.lock();
|
|
|
}
|
|
|
- uint64_t idx = free_list_chunks[p_index / elements_in_chunk][p_index % elements_in_chunk];
|
|
|
- T *ptr = &chunks[idx / elements_in_chunk][idx % elements_in_chunk];
|
|
|
- if (THREAD_SAFE) {
|
|
|
- spin_lock.unlock();
|
|
|
- }
|
|
|
- return ptr;
|
|
|
- }
|
|
|
-
|
|
|
- _FORCE_INLINE_ RID get_rid_by_index(uint32_t p_index) {
|
|
|
- ERR_FAIL_INDEX_V(p_index, alloc_count, RID());
|
|
|
- if (THREAD_SAFE) {
|
|
|
- spin_lock.lock();
|
|
|
+ for (size_t i = 0; i < max_alloc; i++) {
|
|
|
+ uint64_t validator = validator_chunks[i / elements_in_chunk][i % elements_in_chunk];
|
|
|
+ if (validator != 0xFFFFFFFF) {
|
|
|
+ p_owned->push_back(_make_from_id((validator << 32) | i));
|
|
|
+ }
|
|
|
}
|
|
|
- uint64_t idx = free_list_chunks[p_index / elements_in_chunk][p_index % elements_in_chunk];
|
|
|
- uint64_t validator = validator_chunks[idx / elements_in_chunk][idx % elements_in_chunk];
|
|
|
-
|
|
|
- RID rid = _make_from_id((validator << 32) | idx);
|
|
|
if (THREAD_SAFE) {
|
|
|
spin_lock.unlock();
|
|
|
}
|
|
|
- return rid;
|
|
|
}
|
|
|
|
|
|
- void get_owned_list(List<RID> *p_owned) {
|
|
|
+ //used for fast iteration in the elements or RIDs
|
|
|
+ void fill_owned_buffer(RID *p_rid_buffer) {
|
|
|
if (THREAD_SAFE) {
|
|
|
spin_lock.lock();
|
|
|
}
|
|
|
+ uint32_t idx = 0;
|
|
|
for (size_t i = 0; i < max_alloc; i++) {
|
|
|
uint64_t validator = validator_chunks[i / elements_in_chunk][i % elements_in_chunk];
|
|
|
if (validator != 0xFFFFFFFF) {
|
|
|
- p_owned->push_back(_make_from_id((validator << 32) | i));
|
|
|
+ p_rid_buffer[idx] = _make_from_id((validator << 32) | i);
|
|
|
+ idx++;
|
|
|
}
|
|
|
}
|
|
|
if (THREAD_SAFE) {
|
|
@@ -425,18 +414,14 @@ public:
|
|
|
return alloc.get_rid_count();
|
|
|
}
|
|
|
|
|
|
- _FORCE_INLINE_ RID get_rid_by_index(uint32_t p_index) {
|
|
|
- return alloc.get_rid_by_index(p_index);
|
|
|
- }
|
|
|
-
|
|
|
- _FORCE_INLINE_ T *get_ptr_by_index(uint32_t p_index) {
|
|
|
- return *alloc.get_ptr_by_index(p_index);
|
|
|
- }
|
|
|
-
|
|
|
_FORCE_INLINE_ void get_owned_list(List<RID> *p_owned) {
|
|
|
return alloc.get_owned_list(p_owned);
|
|
|
}
|
|
|
|
|
|
+ void fill_owned_buffer(RID *p_rid_buffer) {
|
|
|
+ alloc.fill_owned_buffer(p_rid_buffer);
|
|
|
+ }
|
|
|
+
|
|
|
void set_description(const char *p_descrption) {
|
|
|
alloc.set_description(p_descrption);
|
|
|
}
|
|
@@ -485,17 +470,12 @@ public:
|
|
|
return alloc.get_rid_count();
|
|
|
}
|
|
|
|
|
|
- _FORCE_INLINE_ RID get_rid_by_index(uint32_t p_index) {
|
|
|
- return alloc.get_rid_by_index(p_index);
|
|
|
- }
|
|
|
-
|
|
|
- _FORCE_INLINE_ T *get_ptr_by_index(uint32_t p_index) {
|
|
|
- return alloc.get_ptr_by_index(p_index);
|
|
|
- }
|
|
|
-
|
|
|
_FORCE_INLINE_ void get_owned_list(List<RID> *p_owned) {
|
|
|
return alloc.get_owned_list(p_owned);
|
|
|
}
|
|
|
+ void fill_owned_buffer(RID *p_rid_buffer) {
|
|
|
+ alloc.fill_owned_buffer(p_rid_buffer);
|
|
|
+ }
|
|
|
|
|
|
void set_description(const char *p_descrption) {
|
|
|
alloc.set_description(p_descrption);
|