summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-07-19 19:10:32 +0200
committerEike Rathke <erack@redhat.com>2017-07-19 20:13:58 +0200
commit667aa6ade94a4dee441868d21db037e42c871932 (patch)
tree148c76752126ba4b9322300c3d0b7c8b9d248f82
parentef8f13e08bccb7c082d3c5b19cce8a7a63c0b2fa (diff)
Avoid temporary Date and normalization
Rather than possibly calculating Date=((Date=(Date+int))+int) with a normalization involved for each operator+() force Date=(Date+(int+int)) Change-Id: I6c4b30749d138c0b041ffc9e37796b6f64b6d461
-rw-r--r--sc/source/core/data/conditio.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 9cdb73ea3196..3f83ea2de188 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1649,8 +1649,8 @@ bool ScCondDateFormatEntry::IsValid( const ScAddress& rPos ) const
const DayOfWeek eDay = rActDate.GetDayOfWeek();
if( eDay != SUNDAY )
{
- Date aBegin(rActDate - 8 - static_cast<sal_Int32>(eDay));
- Date aEnd(rActDate - 2 - static_cast<sal_Int32>(eDay));
+ Date aBegin(rActDate - (8 + static_cast<sal_Int32>(eDay)));
+ Date aEnd(rActDate - (2 + static_cast<sal_Int32>(eDay)));
return aCellDate.IsBetween( aBegin, aEnd );
}
else
@@ -1666,8 +1666,8 @@ bool ScCondDateFormatEntry::IsValid( const ScAddress& rPos ) const
const DayOfWeek eDay = rActDate.GetDayOfWeek();
if( eDay != SUNDAY )
{
- Date aBegin(rActDate - 1 - static_cast<sal_Int32>(eDay));
- Date aEnd(rActDate + 5 - static_cast<sal_Int32>(eDay));
+ Date aBegin(rActDate - (1 + static_cast<sal_Int32>(eDay)));
+ Date aEnd(rActDate + (5 + static_cast<sal_Int32>(eDay)));
return aCellDate.IsBetween( aBegin, aEnd );
}
else
@@ -1682,8 +1682,8 @@ bool ScCondDateFormatEntry::IsValid( const ScAddress& rPos ) const
const DayOfWeek eDay = rActDate.GetDayOfWeek();
if( eDay != SUNDAY )
{
- return aCellDate.IsBetween( rActDate + 6 - static_cast<sal_Int32>(eDay),
- rActDate + 12 - static_cast<sal_Int32>(eDay) );
+ return aCellDate.IsBetween( rActDate + (6 - static_cast<sal_Int32>(eDay)),
+ rActDate + (12 - static_cast<sal_Int32>(eDay)) );
}
else
{