Helper function for ParseFixedPoint */
| 380 | |
| 381 | /** Helper function for ParseFixedPoint */ |
| 382 | static inline bool ProcessMantissaDigit(char ch, int64_t &mantissa, int &mantissa_tzeros) |
| 383 | { |
| 384 | if(ch == '0') |
| 385 | ++mantissa_tzeros; |
| 386 | else { |
| 387 | for (int i=0; i<=mantissa_tzeros; ++i) { |
| 388 | if (mantissa > (UPPER_BOUND / 10LL)) |
| 389 | return false; /* overflow */ |
| 390 | mantissa *= 10; |
| 391 | } |
| 392 | mantissa += ch - '0'; |
| 393 | mantissa_tzeros = 0; |
| 394 | } |
| 395 | return true; |
| 396 | } |
| 397 | |
| 398 | bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out) |
| 399 | { |