From 4d298c9e39b5fcea11e122062403c7e68dcbe2e6 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 16 Jun 2014 17:18:08 +0000 Subject: [PATCH] algorithm: tweak the sort routines so that they only use the "<" operator. --- src/lol/algorithm/sort.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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--; } }