Replace iterator in NumberToString with index (conv.cpp)

This commit is contained in:
fwcd 2019-04-06 23:00:11 +02:00
commit 6035571b96

View file

@ -1199,7 +1199,7 @@ wstring NumberToString(_Inout_ PNUMBER& pnum, int format, uint32_t radix, int32_
// Set up all the post rounding stuff. // Set up all the post rounding stuff.
bool useSciForm = false; bool useSciForm = false;
int32_t eout = exponent - 1; // Displayed exponent. int32_t eout = exponent - 1; // Displayed exponent.
vector<MANTTYPE>::iterator pmant = pnum->mant.begin() + pnum->cdigit - 1; int32_t imant = pnum->cdigit - 1;
// Case where too many digits are to the left of the decimal or // Case where too many digits are to the left of the decimal or
// FMT_SCIENTIFIC or FMT_ENGINEERING was specified. // FMT_SCIENTIFIC or FMT_ENGINEERING was specified.
if ((format == FMT_SCIENTIFIC) || (format == FMT_ENGINEERING)) if ((format == FMT_SCIENTIFIC) || (format == FMT_ENGINEERING))
@ -1256,7 +1256,7 @@ wstring NumberToString(_Inout_ PNUMBER& pnum, int format, uint32_t radix, int32_
while (length > 0) while (length > 0)
{ {
exponent--; exponent--;
resultStream << DIGITS[*pmant--]; resultStream << DIGITS[pnum->mant[imant--]];
length--; length--;
// Be more regular in using a decimal point. // Be more regular in using a decimal point.