diff options
author | Eike Rathke <erack@redhat.com> | 2022-11-22 19:04:13 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2022-11-22 20:13:01 +0100 |
commit | 8cc4e6c8f572d84dc004d97fa25d17fe85505dc6 (patch) | |
tree | d5cd60d8084066ced4b2af5495161b64e71caa9d /comphelper | |
parent | 00ee70be17c1c466674552b59737e39fb785e907 (diff) |
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
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/date.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/comphelper/source/misc/date.cxx b/comphelper/source/misc/date.cxx index ea8a588dbabd..b14ef501d331 100644 --- a/comphelper/source/misc/date.cxx +++ b/comphelper/source/misc/date.cxx @@ -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); |