summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-09-30 09:15:01 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-09-30 10:26:56 +0200
commit0b81761c86786eeb035f857f549d75f143e491ad (patch)
tree50a0f1fba10d58088c8fef40f9ad6b0d9020d9b8 /sal
parent4d445ac9aa43b3399a579e3dbb1aac94507c9520 (diff)
Simplify comparisons in the loop
Change-Id: I9963a527d2323f4df8c3b46c13f5b7993e22f163 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122855 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/math.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 0cd53cd3902a..95dd6ae41bc6 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -367,22 +367,22 @@ void doubleToString(typename T::String ** pResult,
typename T::Char* pStart = pEnd;
// Backward fill.
- size_t nGrouping = 0;
+ sal_Int32 nGrouping = cGroupSeparator && pGroups ? *pGroups : 0;
sal_Int32 nGroupDigits = 0;
do
{
typename T::Char nDigit = nInt % 10;
nInt /= 10;
*--pStart = nDigit + '0';
- if (pGroups && pGroups[nGrouping] == ++nGroupDigits && nInt > 0 && cGroupSeparator)
+ if (nGrouping && nGrouping == ++nGroupDigits && nInt)
{
*--pStart = cGroupSeparator;
- if (pGroups[nGrouping+1])
- ++nGrouping;
+ if (*(pGroups + 1))
+ nGrouping = *++pGroups;
nGroupDigits = 0;
}
}
- while (nInt > 0);
+ while (nInt);
if (bSign)
*--pStart = '-';