[Libreoffice-commits] core.git: sc/source
Tamás Zolnai
tamas.zolnai at collabora.com
Sun Nov 20 13:10:02 UTC 2016
sc/source/core/data/dptabres.cxx | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
New commits:
commit e2ebfc5d5378453a0e1df5d37851def54e29b04b
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date: Sun Nov 20 14:07:29 2016 +0100
Simplify this code.
Change-Id: I2a82d99277114135c4dde8ef83fc454329411c21
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 233329c..9f2b53d 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -547,13 +547,16 @@ void ScDPAggData::Calculate( ScSubTotalFunc eFunc, const ScDPSubTotalState& rSub
fResult = (fAux - fVal*fVal/(double)(nCount)) / (double)nCount;
break;
case SUBTOTAL_FUNC_MED:
- if (mSortedValues.size() > 0)
{
- assert(mSortedValues.size() == static_cast<size_t>(nCount));
- if ((mSortedValues.size() % 2) == 1)
- fResult = mSortedValues[mSortedValues.size() / 2];
- else
- fResult = (mSortedValues[mSortedValues.size() / 2 - 1] + mSortedValues[mSortedValues.size() / 2]) / 2.0;
+ size_t nSize = mSortedValues.size();
+ if (nSize > 0)
+ {
+ assert(nSize == static_cast<size_t>(nCount));
+ if ((nSize % 2) == 1)
+ fResult = mSortedValues[nSize / 2];
+ else
+ fResult = (mSortedValues[nSize / 2 - 1] + mSortedValues[nSize / 2]) / 2.0;
+ }
}
break;
default:
More information about the Libreoffice-commits
mailing list