MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / allocate_view_strict

Method allocate_view_strict

modules/engine/runtime/src/ecs/storage.cpp:72–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72sugoi_chunk_view_t sugoi_storage_t::allocate_view_strict(sugoi_group_t* group, EIndex count)
73{
74 sugoi_chunk_t* freeChunk = nullptr;
75 for (auto i = group->firstFree; i < (uint32_t)group->chunks.size(); ++i)
76 {
77 auto chunk = group->chunks[i];
78 if (chunk->count + count <= chunk->get_capacity())
79 {
80 freeChunk = chunk;
81 break;
82 }
83 }
84 if (freeChunk == nullptr)
85 freeChunk = group->new_chunk(count);
86 EIndex start = freeChunk->count;
87 group->resize_chunk(freeChunk, start + count);
88 structural_change(group, freeChunk);
89 return { freeChunk, start, count };
90}
91
92void sugoi_storage_t::destroy(const sugoi_chunk_view_t& view)
93{

Callers

nothing calls this directly

Calls 4

new_chunkMethod · 0.80
resize_chunkMethod · 0.80
sizeMethod · 0.45
get_capacityMethod · 0.45

Tested by

no test coverage detected