Commit a0a45f0d authored by Richard Gobeille's avatar Richard Gobeille
Browse files

engine: fix potential crash in LRU, optimize branching

parent b9e67132
......@@ -68,9 +68,9 @@ public:
m_head = -1;
else if (m_count < Capacity)
++m_count;
if (++m_head == m_tail || m_tail == -1)
if ((++m_head == m_tail) | (m_tail == -1))
{
if (ResetItems & RF_FREE)
if ((m_tail != -1) & ((ResetItems & RF_FREE) == RF_FREE))
Xfree(m_items[m_tail]);
m_tail = (m_tail + 1) % Capacity;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment