Helper function for ParseFixedPoint */
| 552 | |
| 553 | /** Helper function for ParseFixedPoint */ |
| 554 | static inline bool ProcessMantissaDigit(char ch, int64_t &mantissa, int &mantissa_tzeros) |
| 555 | { |
| 556 | if(ch == '0') |
| 557 | ++mantissa_tzeros; |
| 558 | else { |
| 559 | for (int i=0; i<=mantissa_tzeros; ++i) { |
| 560 | if (mantissa > (UPPER_BOUND / 10LL)) |
| 561 | return false; /* overflow */ |
| 562 | mantissa *= 10; |
| 563 | } |
| 564 | mantissa += ch - '0'; |
| 565 | mantissa_tzeros = 0; |
| 566 | } |
| 567 | return true; |
| 568 | } |
| 569 | |
| 570 | bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out) |
| 571 | { |