Browse Source

Make some AVL tree code less verbose.

legacy
Sam Hocevar 7 years ago
parent
commit
9981cf4ce9
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/lol/base/avl_tree.h

+ 2
- 2
src/lol/base/avl_tree.h View File

@@ -341,8 +341,8 @@ protected:

void update_balance()
{
m_stairs[0] = m_child[0] ? (m_child[0]->m_stairs[0] > m_child[0]->m_stairs[1] ? m_child[0]->m_stairs[0] : m_child[0]->m_stairs[1]) + 1 : 0;
m_stairs[1] = m_child[1] ? (m_child[1]->m_stairs[0] > m_child[1]->m_stairs[1] ? m_child[1]->m_stairs[0] : m_child[1]->m_stairs[1]) + 1 : 0;
for (int i = 0; i <= 1; ++i)
m_stairs[i] = m_child[i] ? std::max(m_child[i]->m_stairs[0], m_child[i]->m_stairs[1]) + 1 : 0;
}

void rebalance_if_needed()


Loading…
Cancel
Save