diff --git a/src/lol/algorithm/sort.h b/src/lol/algorithm/sort.h index 895eb846..0a2b7495 100644 --- a/src/lol/algorithm/sort.h +++ b/src/lol/algorithm/sort.h @@ -27,7 +27,7 @@ void ArrayBase::Sort(int sort) int d = 1; for (int i = 0; i < Count() - 1; i = lol::max(i + d, 0)) { - if (m_data[i] < m_data[i + 1] || i <= 0) + if (i <= 0 || m_data[i] < m_data[i + 1]) d = 1; if (m_data[i + 1] < m_data[i]) { @@ -72,7 +72,7 @@ void ArrayBase::SortQuickSwap(int start, int stop) bool swap = false; while (i0 < i1) { - if (m_data[i0] >= median && m_data[i1] < median) + if (!(m_data[i0] < median) && m_data[i1] < median) { Swap(i0, i1); i0++; @@ -83,7 +83,7 @@ void ArrayBase::SortQuickSwap(int start, int stop) { if (m_data[i0] < median) i0++; - if (m_data[i1] >= median) + if (!(m_data[i1] < median)) i1--; } }