diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2013-09-12 09:46:16 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-12 14:48:58 +0200 |
commit | 46df8921e7c9a7936087593f1060ca2e8f1d512d (patch) | |
tree | 5f729a88a2744040900cf7a1c6bfb0719f1af6b8 /src/concurrent | |
parent | 472f3c17e302d0eb7376f3f8e2716a51e1d0f5cf (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/concurrent')
-rw-r--r-- | src/concurrent/qtconcurrentmedian.h | 2 |
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; } |