[Libreoffice-commits] core.git: Branch 'feature/fixes11' - sc/source
László Németh
laszlo.nemeth at collabora.com
Fri Nov 6 02:08:39 PST 2015
sc/source/core/tool/interpr6.cxx | 75 +++++++++++----------------------------
1 file changed, 22 insertions(+), 53 deletions(-)
New commits:
commit 369a3f9cfa6738e8cd02fb41726f536694618ead
Author: László Németh <laszlo.nemeth at collabora.com>
Date: Fri Nov 6 11:07:02 2015 +0100
Revert "Adapt FuncSum to vectorize better - potentially ..."
This reverts commit 14635e66cd1e948d1c7ff4e90973fc62567cb801.
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 50c0768a..694a403 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -203,11 +203,6 @@ double ScInterpreter::GetGammaDist( double fX, double fAlpha, double fLambda )
namespace {
-// this is unpleasant - but ... we want raw access.
-struct puncture_mdds_encap : public sc::numeric_block {
- const double *getPtr(size_t nOffset) const { return &m_array[nOffset]; }
-};
-
class NumericCellAccumulator
{
double mfSum;
@@ -216,58 +211,32 @@ class NumericCellAccumulator
public:
NumericCellAccumulator() : mfSum(0.0), mnError(0) {}
- void operator() (const sc::CellStoreType::value_type& rNode, size_t nOffset, size_t nDataSize)
+ void operator() (size_t, double fVal)
{
- switch (rNode.type)
- {
- case sc::element_type_numeric:
- {
- const puncture_mdds_encap *pBlock = static_cast<const puncture_mdds_encap *>(rNode.data);
- const double *p = pBlock->getPtr(nOffset);
- size_t i, nUnrolled = (nDataSize & 0x3) >> 2;
-
- // Try to encourage the compiler/CPU to do something sensible (?)
- for (i = 0; i < nUnrolled; i+=4)
- {
- mfSum += p[i];
- mfSum += p[i+1];
- mfSum += p[i+2];
- mfSum += p[i+3];
- }
- for (; i < nDataSize; ++i)
- mfSum += p[i];
- break;
- }
+ mfSum += fVal;
+ }
- case sc::element_type_formula:
- {
- sc::formula_block::const_iterator it = sc::formula_block::begin(*rNode.data);
- std::advance(it, nOffset);
- sc::formula_block::const_iterator itEnd = it;
- std::advance(itEnd, nDataSize);
- for (; it != itEnd; ++it)
- {
- double fVal = 0.0;
- sal_uInt16 nErr = 0;
- ScFormulaCell& rCell = const_cast<ScFormulaCell&>(*(*it));
- if (!rCell.GetErrorOrValue(nErr, fVal))
- // The cell has neither error nor value. Perhaps string result.
- continue;
+ void operator() (size_t, const ScFormulaCell* pCell)
+ {
+ if (mnError)
+ // Skip all the rest if we have an error.
+ return;
- if (nErr)
- {
- // Cell has error - skip all the rest
- mnError = nErr;
- return;
- }
+ double fVal = 0.0;
+ sal_uInt16 nErr = 0;
+ ScFormulaCell& rCell = const_cast<ScFormulaCell&>(*pCell);
+ if (!rCell.GetErrorOrValue(nErr, fVal))
+ // The cell has neither error nor value. Perhaps string result.
+ return;
- mfSum += fVal;
- }
- }
- break;
- default:
- ;
+ if (nErr)
+ {
+ // Cell has error.
+ mnError = nErr;
+ return;
}
+
+ mfSum += fVal;
}
sal_uInt16 getError() const { return mnError; }
@@ -366,7 +335,7 @@ public:
return;
NumericCellAccumulator aFunc;
- maPos.miCellPos = sc::ParseBlock(maPos.miCellPos, mpCol->GetCellStore(), aFunc, nRow1, nRow2);
+ maPos.miCellPos = sc::ParseFormulaNumeric(maPos.miCellPos, mpCol->GetCellStore(), nRow1, nRow2, aFunc);
mnError = aFunc.getError();
if (mnError)
return;
More information about the Libreoffice-commits
mailing list