sc/source/core/tool/interpr3.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
New commits: commit d155f7af035e0fd818340c1affe41d3b6e97b502 Author: Takeshi Abe <t...@fixedpoint.jp> Date: Wed Jun 6 19:05:01 2018 +0900 sc: A putative micro optimization of MEDIAN() for even-length arrays As the previous run of std::nth_element() already collects all of smaller elements than the upper median into the first half of the vector (which may also contain an equal one to the upper median, that's OK), we can safely ignore the later half for finding the lower median. Change-Id: I64c97ee03b02ea363399077244dd99d0d10defcb Reviewed-on: https://gerrit.libreoffice.org/55370 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index b52a62fd3d20..a43ec7835193 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -3374,8 +3374,7 @@ double ScInterpreter::GetMedian( vector<double> & rArray ) { double fUp = *iMid; // Lower median. - iMid = rArray.begin() + nMid - 1; - ::std::nth_element( rArray.begin(), iMid, rArray.end()); + iMid = ::std::max_element( rArray.begin(), rArray.begin() + nMid); return (fUp + *iMid) / 2; } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits