Helper function for ParseFixedPoint */
| 641 | |
| 642 | /** Helper function for ParseFixedPoint */ |
| 643 | static inline bool ProcessMantissaDigit(char ch, int64_t &mantissa, int &mantissa_tzeros) |
| 644 | { |
| 645 | if(ch == '0') |
| 646 | ++mantissa_tzeros; |
| 647 | else { |
| 648 | for (int i=0; i<=mantissa_tzeros; ++i) { |
| 649 | if (mantissa > (UPPER_BOUND / 10LL)) |
| 650 | return false; /* overflow */ |
| 651 | mantissa *= 10; |
| 652 | } |
| 653 | mantissa += ch - '0'; |
| 654 | mantissa_tzeros = 0; |
| 655 | } |
| 656 | return true; |
| 657 | } |
| 658 | |
| 659 | bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out) |
| 660 | { |