From 46df8921e7c9a7936087593f1060ca2e8f1d512d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 12 Sep 2013 09:46:16 +0200 Subject: 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 --- src/concurrent/qtconcurrentmedian.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/concurrent') 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 sorted = values; qSort(sorted); - currentMedian = sorted.at(bufferSize / 2 + 1); + currentMedian = sorted.at(bufferSize / 2); } return currentMedian; } -- cgit v1.2.3