mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Use an index instead of a vector::iterator in StringToNumber
This commit is contained in:
parent
d21474e690
commit
4053620e3e
1 changed files with 2 additions and 2 deletions
|
@ -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++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue