-almost every funtion is marked as @nogc and nothrow (only problem with HashMap)
This commit is contained in:
parent
fef55bd790
commit
204ce9dc79
10 changed files with 74 additions and 72 deletions
|
|
@ -18,7 +18,7 @@ struct IDManager
|
|||
/************************************************************************************************************************
|
||||
*Get new ID.
|
||||
*/
|
||||
pragma(inline, false) EntityID getNewID()
|
||||
pragma(inline, false) EntityID getNewID() nothrow @nogc
|
||||
{
|
||||
//uint current = m_next_id;
|
||||
//uint next;// = m_ids_array[m_next_id].next_id;
|
||||
|
|
@ -35,13 +35,13 @@ begin:
|
|||
uint block_id = local_id >> 16;
|
||||
if (block_id >= m_blocks_count)
|
||||
{
|
||||
add_mutex.lock();
|
||||
add_mutex.lock_nothrow();
|
||||
if(block_id >= m_blocks_count)
|
||||
{
|
||||
m_blocks[m_blocks_count].alloc();
|
||||
m_blocks_count++;
|
||||
}
|
||||
add_mutex.unlock();
|
||||
add_mutex.unlock_nothrow();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ begin:
|
|||
/************************************************************************************************************************
|
||||
*Release ID.
|
||||
*/
|
||||
void releaseID(EntityID id)
|
||||
void releaseID(EntityID id) nothrow @nogc
|
||||
{
|
||||
Data* data = &m_ids_array[id.id];
|
||||
if (data.counter != id.counter)
|
||||
|
|
@ -96,7 +96,7 @@ begin:
|
|||
/************************************************************************************************************************
|
||||
*Update pointer to entity. The purpose of this function is to ensure that pointer to entity is always correct.
|
||||
*/
|
||||
void update(ref Entity entity)
|
||||
void update(ref Entity entity) nothrow @nogc
|
||||
{
|
||||
if (entity.id.id >= cast(uint) m_ids_array.length)
|
||||
{
|
||||
|
|
@ -112,7 +112,7 @@ begin:
|
|||
/************************************************************************************************************************
|
||||
*Returns pointer to entity.
|
||||
*/
|
||||
export Entity* getEntityPointer(EntityID id)
|
||||
export Entity* getEntityPointer(EntityID id) nothrow @nogc
|
||||
{
|
||||
if (id.id >= m_ids_array.length)
|
||||
{
|
||||
|
|
@ -137,13 +137,13 @@ begin:
|
|||
/************************************************************************************************************************
|
||||
*Check if entity with specified ID exist.
|
||||
*/
|
||||
export bool isExist(EntityID id)
|
||||
export bool isExist(EntityID id) nothrow @nogc
|
||||
{
|
||||
Data* data = &m_ids_array[id.id];
|
||||
return data.counter == id.counter;
|
||||
}
|
||||
|
||||
void initialize()
|
||||
void initialize() nothrow @nogc
|
||||
{
|
||||
m_ids_array = Mallocator.instance.makeArray!Data(65536);
|
||||
m_free_stack = Mallocator.instance.makeArray!uint(65536);
|
||||
|
|
@ -154,7 +154,7 @@ begin:
|
|||
add_mutex = Mallocator.instance.make!Mutex();
|
||||
}
|
||||
|
||||
void optimize()
|
||||
void optimize() nothrow @nogc
|
||||
{
|
||||
if(m_stack_top < -1)m_stack_top = -1;
|
||||
if(m_last_id > m_ids_array.length)
|
||||
|
|
@ -183,13 +183,13 @@ begin:
|
|||
|
||||
private static struct Block
|
||||
{
|
||||
void alloc()
|
||||
void alloc() nothrow @nogc
|
||||
{
|
||||
assert(data is null);
|
||||
data = Mallocator.instance.makeArray!Data(65536);
|
||||
}
|
||||
|
||||
void free()
|
||||
void free() nothrow @nogc
|
||||
{
|
||||
assert(data !is null);
|
||||
Mallocator.instance.dispose(data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue