diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2018-10-17 21:54:53 +0900 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-17 07:33:50 +0100 |
commit | f5011d7226060e04e7b92f035f71e285b853712c (patch) | |
tree | f10571487a82be4fee70f30a8b408b4fc69d4cee | |
parent | 70a60cece0666b226c4f36d87d85ec9841bfb67c (diff) |
sc: Calculate the value only once for micro-optimization
Change-Id: I394bca979d4b914d6b6997837fab636b9bc4e479
Reviewed-on: https://gerrit.libreoffice.org/61879
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sc/source/core/tool/interpr5.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 2b30f4e1fe49..b1c840e4fd94 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -1861,8 +1861,11 @@ double lcl_GetColumnMaximumNorm(const ScMatrixRef& pMatA, SCSIZE nC, SCSIZE nR, { double fNorm = 0.0; for (SCSIZE row=nR; row<nN; row++) - if (fNorm < fabs(pMatA->GetDouble(nC,row))) - fNorm = fabs(pMatA->GetDouble(nC,row)); + { + double fVal = fabs(pMatA->GetDouble(nC,row)); + if (fNorm < fVal) + fNorm = fVal; + } return fNorm; } @@ -1872,8 +1875,11 @@ double lcl_TGetColumnMaximumNorm(const ScMatrixRef& pMatA, SCSIZE nR, SCSIZE nC, { double fNorm = 0.0; for (SCSIZE col=nC; col<nN; col++) - if (fNorm < fabs(pMatA->GetDouble(col,nR))) - fNorm = fabs(pMatA->GetDouble(col,nR)); + { + double fVal = fabs(pMatA->GetDouble(col,nR)); + if (fNorm < fVal) + fNorm = fVal; + } return fNorm; } |