1816
Modification Help / Re: [RESOURCE] LIHO/HILO Queue
« on: June 05, 2014, 01:19:26 AM »You don't need to handle wrapping as a normal queue would overflow too anyway.
Something like this:
%this.head = -1;
%this.tail = 0;
push(%value)
{
%this.value[%this.head++] = %value;
}
pop()
{
if (%this.head < %this.tail)
{
return "";
}
%value = %this.value[%this.tail];
%this.value[%this.tail] = "";
%this.tail++;
if (%this.tail > %this.head)
{
%this.head = -1;
%this.tail = 0;
}
return %value;
}