Improved documentation and removed some old code
This commit is contained in:
parent
5411e97cb1
commit
46aba822d0
3 changed files with 21 additions and 40 deletions
|
|
@ -17,10 +17,6 @@ struct IDManager
|
|||
*/
|
||||
pragma(inline, false) EntityID getNewID() nothrow @nogc
|
||||
{
|
||||
//uint current = m_next_id;
|
||||
//uint next;// = m_ids_array[m_next_id].next_id;
|
||||
//begin:
|
||||
//if (current == uint.max)//> m_last_id)
|
||||
int current = m_stack_top.atomicOp!"-="(1) + 1;
|
||||
if(current < 0)
|
||||
{
|
||||
|
|
@ -48,29 +44,11 @@ struct IDManager
|
|||
return id;
|
||||
}
|
||||
|
||||
|
||||
//current += 1;
|
||||
uint index = m_free_stack[current];
|
||||
EntityID id;
|
||||
id.id = index;
|
||||
id.counter = m_ids_array[index].counter;
|
||||
//current = m_ids_array[index].next_id;
|
||||
return id;
|
||||
|
||||
/*next = m_ids_array[current].next_id;
|
||||
if(cas(&m_next_id,current,next))
|
||||
{
|
||||
EntityID id;
|
||||
id.id = current;
|
||||
id.counter = m_ids_array[current].counter;
|
||||
m_next_id = m_ids_array[current].next_id;
|
||||
return id;
|
||||
}
|
||||
else
|
||||
{
|
||||
current = next;
|
||||
goto begin;
|
||||
}*/
|
||||
}
|
||||
|
||||
/************************************************************************************************************************
|
||||
|
|
@ -82,9 +60,7 @@ struct IDManager
|
|||
if (data.counter != id.counter)
|
||||
return;
|
||||
data.counter++;
|
||||
//data.next_id = m_next_id;
|
||||
data.entity = null;
|
||||
///m_next_id = id.id;
|
||||
|
||||
m_stack_top.atomicOp!"+="(1);
|
||||
m_free_stack[m_stack_top] = id.id;
|
||||
|
|
@ -241,13 +217,10 @@ struct IDManager
|
|||
|
||||
private:
|
||||
Mutex* add_mutex;
|
||||
//shared uint m_next_id = 0;
|
||||
|
||||
//shared uint m_last_id = 0;
|
||||
Data[] m_ids_array = null;
|
||||
uint m_blocks_count = 0;
|
||||
Block[] m_blocks;
|
||||
//shared int m_stack_top = -1;
|
||||
uint[] m_free_stack = null;
|
||||
|
||||
align(64) shared uint m_last_id = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue