summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2013-09-12 09:46:16 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-12 14:48:58 +0200
commit46df8921e7c9a7936087593f1060ca2e8f1d512d (patch)
tree5f729a88a2744040900cf7a1c6bfb0719f1af6b8 /src
parent472f3c17e302d0eb7376f3f8e2716a51e1d0f5cf (diff)
QtConcurrent: fix median calculation
The median, for arrays of odd size, is found in [size/2], not [size/2+1]. For arrays of even size, the code doesn't work anyway, so nothing to do there. Change-Id: Id23ff3fe9538c2d8ef8f88e23127cb92af08b444 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r--src/concurrent/qtconcurrentmedian.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h
index 7d3b50a45b..f93dc1d60b 100644
--- a/src/concurrent/qtconcurrentmedian.h
+++ b/src/concurrent/qtconcurrentmedian.h
@@ -103,7 +103,7 @@ public:
dirty = false;
QVector<T> sorted = values;
qSort(sorted);
- currentMedian = sorted.at(bufferSize / 2 + 1);
+ currentMedian = sorted.at(bufferSize / 2);
}
return currentMedian;
}