Calculate null-date days to assert only once
Massively called it is really unnecessary to do that each and every time. The debug build is slow enough.. Change-Id: I06525e4ca1fa23a1d49dd735370eb157157800e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143127 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
This commit is contained in:
@@ -100,7 +100,10 @@ sal_Int32 convertDateToDaysNormalizing(sal_uInt16 nDay, sal_uInt16 nMonth, sal_I
|
||||
// Speed-up the common null-date 1899-12-30.
|
||||
if (nYear == 1899 && nDay == 30 && nMonth == 12)
|
||||
{
|
||||
assert(convertDateToDays(nDay, nMonth, nYear) == 693594);
|
||||
#ifndef NDEBUG
|
||||
static sal_Int32 nDays = convertDateToDays(nDay, nMonth, nYear);
|
||||
assert(nDays == 693594);
|
||||
#endif
|
||||
return 693594;
|
||||
}
|
||||
normalize(nDay, nMonth, nYear);
|
||||
|
||||
@@ -72,7 +72,10 @@ sal_Int32 Date::GetAsNormalizedDays() const
|
||||
// This is a very common datum we often calculate from.
|
||||
if (mnDate == 18991230) // 1899-12-30
|
||||
{
|
||||
assert(DateToDays( GetDay(), GetMonth(), GetYear() ) == 693594);
|
||||
#ifndef NDEBUG
|
||||
static sal_Int32 nDays = DateToDays( GetDay(), GetMonth(), GetYear());
|
||||
assert(nDays == 693594);
|
||||
#endif
|
||||
return 693594;
|
||||
}
|
||||
// Not calling comphelper::date::convertDateToDaysNormalizing() here just
|
||||
|
||||
Reference in New Issue
Block a user