Use an index instead of a vector::iterator in StringToNumber

This commit is contained in:
fwcd 2019-04-06 23:58:39 +02:00
commit 4053620e3e

View file

@ -653,7 +653,7 @@ PNUMBER StringToNumber(wstring_view numberString, uint32_t radix, int32_t precis
pnumret->sign = 1L; pnumret->sign = 1L;
pnumret->cdigit = 0; pnumret->cdigit = 0;
pnumret->exp = 0; pnumret->exp = 0;
vector<MANTTYPE>::iterator pmant = pnumret->mant.begin() + numberString.length() - 1; int32_t imant = static_cast<int32_t>(numberString.length() - 1);
uint8_t state = START; // state is the state of the input state machine. uint8_t state = START; // state is the state of the input state machine.
wchar_t curChar; wchar_t curChar;
@ -726,7 +726,7 @@ PNUMBER StringToNumber(wstring_view numberString, uint32_t radix, int32_t precis
size_t pos = DIGITS.find(curChar); size_t pos = DIGITS.find(curChar);
if (pos != wstring_view::npos && pos < static_cast<size_t>(radix)) if (pos != wstring_view::npos && pos < static_cast<size_t>(radix))
{ {
*pmant-- = static_cast<MANTTYPE>(pos); pnumret->mant[imant--] = static_cast<MANTTYPE>(pos);
pnumret->exp--; pnumret->exp--;
pnumret->cdigit++; pnumret->cdigit++;
} }