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>
This commit is contained in:
Marc Mutz 2013-09-12 09:46:16 +02:00 committed by The Qt Project
parent 472f3c17e3
commit 46df8921e7

View File

@ -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;
}