Helper function for ParseFixedPoint */
| 438 | |
| 439 | /** Helper function for ParseFixedPoint */ |
| 440 | static inline bool ProcessMantissaDigit(char ch, int64_t &mantissa, int &mantissa_tzeros) |
| 441 | { |
| 442 | if(ch == '0') |
| 443 | ++mantissa_tzeros; |
| 444 | else { |
| 445 | for (int i=0; i<=mantissa_tzeros; ++i) { |
| 446 | if (mantissa > (UPPER_BOUND / 10LL)) |
| 447 | return false; /* overflow */ |
| 448 | mantissa *= 10; |
| 449 | } |
| 450 | mantissa += ch - '0'; |
| 451 | mantissa_tzeros = 0; |
| 452 | } |
| 453 | return true; |
| 454 | } |
| 455 | |
| 456 | bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out) |
| 457 | { |