sc/source/core/tool/interpr1.cxx | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-)
New commits: commit 3fed166279377f7ad702b8911899243b8adff3bf Author: Pierre-Eric Pelloux-Prayer <pierre-e...@lanedo.com> Date: Fri Aug 16 16:29:38 2013 +0200 interpr/vlookup: use ScMatrix func to find matching cells Moves the cpu intensive code to ScMatrix, where we can use our knowledge of the internal structure: use mdds::multi_type_matrix::walk instead of browsing cells one by one. Change-Id: Ie1df20e2be6414b8e21b4d58b7697a0801222c1e Reviewed-on: https://gerrit.libreoffice.org/5455 Reviewed-by: Kohei Yoshida <kohei.yosh...@suse.de> Tested-by: Kohei Yoshida <kohei.yosh...@suse.de> diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 5043272..ba26581 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -6565,18 +6565,25 @@ void ScInterpreter::CalculateLookup(bool HLookup) } else { - for (SCSIZE i = 0; i < nMatCount; i++) + if (HLookup) { - if (HLookup ? pMat->IsString(i, 0) : pMat->IsString(0, i)) + for (SCSIZE i = 0; i < nMatCount; i++) { - if ( ScGlobal::GetpTransliteration()->isEqual( - HLookup ? pMat->GetString(i,0) : pMat->GetString(0,i), rParamStr)) + if (pMat->IsString(i, 0)) { - nDelta = i; - i = nMatCount + 1; + if ( ScGlobal::GetpTransliteration()->isEqual( + pMat->GetString(i,0), rParamStr)) + { + nDelta = i; + i = nMatCount + 1; + } } } } + else + { + nDelta = pMat->MatchStringInColumns(rParamStr, 0, 0); + } } } else @@ -6597,17 +6604,24 @@ void ScInterpreter::CalculateLookup(bool HLookup) } else { - for (SCSIZE i = 0; i < nMatCount; i++) + if (HLookup) { - if (!(HLookup ? pMat->IsString(i, 0) : pMat->IsString(0, i))) + for (SCSIZE i = 0; i < nMatCount; i++) { - if ((HLookup ? pMat->GetDouble(i,0) : pMat->GetDouble(0,i)) == rItem.mfVal) + if (! pMat->IsString(i, 0) ) { - nDelta = i; - i = nMatCount + 1; + if ( pMat->GetDouble(i,0) == rItem.mfVal) + { + nDelta = i; + i = nMatCount + 1; + } } } } + else + { + nDelta = pMat->MatchDoubleInColumns(rItem.mfVal, 0, 0); + } } } if ( nDelta != SCSIZE_MAX ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits