[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon May 2 15:34:30 PDT 2011


 sc/source/core/data/dptablecache.cxx |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 80973113dc3694fade12fcd148f8f457e4dbf9c6
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Mon May 2 18:34:47 2011 -0400

    Avoid branching in for loop.

diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx
index b468b9f..85ae11e 100644
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -486,15 +486,12 @@ bool ScDPCache::InitFromDoc(ScDocument* pDoc, const ScRange& rRange)
         maIndexOrder.push_back(new vector<SCROW>());
     }
     //check valid
-    for ( SCROW nRow = nStartRow; nRow <= nEndRow; nRow ++ )
+
+    for (sal_uInt16 nCol = nStartCol; nCol <= nEndCol; ++nCol)
     {
-        for ( sal_uInt16 nCol = nStartCol; nCol <= nEndCol; nCol++ )
-        {
-            if ( nRow == nStartRow )
-                AddLabel( new ScDPItemData( pDoc, nRow, nCol, nDocTab  ) );
-            else
-                AddData( nCol - nStartCol, new ScDPItemData( pDoc, nRow, nCol, nDocTab  ) );
-        }
+        AddLabel(new ScDPItemData(pDoc, nStartRow, nCol, nDocTab));
+        for (SCROW nRow = nStartRow + 1; nRow <= nEndRow; ++nRow)
+            AddData(nCol - nStartCol, new ScDPItemData(pDoc, nRow, nCol, nDocTab));
     }
     return true;
 }


More information about the Libreoffice-commits mailing list