summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-05-02 18:34:47 -0400
committerKohei Yoshida <kyoshida@novell.com>2011-05-02 18:34:47 -0400
commita2865aca05f7c07b9796fcbf999ba5af12070b01 (patch)
tree35bad2f3c7b23461cb51168f12ba4826681fd2b4 /sc/source
parentaa5aced99f926b5be4968b0eb653fe35d5dcd0cc (diff)
Avoid branching in for loop.
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/dptablecache.cxx13
1 files changed, 5 insertions, 8 deletions
diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx
index 2641c69d5b44..0d7272713c70 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;
}