ICU-13672 Replacing % and / with std::div in toNumberString function.

X-SVN-Rev: 41200
This commit is contained in:
Shane Carr 2018-04-05 22:00:10 +00:00
parent afda6f1378
commit 96bf6508ef

View File

@ -9,6 +9,7 @@
#include <cmath>
#include "cmemory.h"
#include <limits>
#include <stdlib.h>
#include "putilimp.h"
#include "number_decimalquantity.h"
#include "number_roundingutils.h"
@ -1114,8 +1115,9 @@ UnicodeString DecimalQuantity::toNumberString() const {
}
int32_t insertIndex = result.length();
while (_scale > 0) {
result.insert(insertIndex, u'0' + (_scale % 10));
_scale /= 10;
std::div_t res = std::div(_scale, 10);
result.insert(insertIndex, u'0' + res.rem);
_scale = res.quot;
}
return result;
}