public void UpdateEntry(LadderEntry entry) { int index = entry.Index; if (index >= 0 && index < m_Entries.Count) { // sanity int c; while ((index - 1) >= 0 && (c = entry.CompareTo(m_Entries[index - 1])) < 0) { index = Swap(index, index - 1); } while ((index + 1) < m_Entries.Count && (c = entry.CompareTo(m_Entries[index + 1])) > 0) { index = Swap(index, index + 1); } } }