MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / ProcessMantissaDigit

Function ProcessMantissaDigit

src/utilstrencodings.cpp:440–454  ·  view source on GitHub ↗

Helper function for ParseFixedPoint */

Source from the content-addressed store, hash-verified

438
439/** Helper function for ParseFixedPoint */
440static 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
456bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out)
457{

Callers 1

ParseFixedPointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected