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

Function ProcessMantissaDigit

src/utilstrencodings.cpp:554–568  ·  view source on GitHub ↗

Helper function for ParseFixedPoint */

Source from the content-addressed store, hash-verified

552
553/** Helper function for ParseFixedPoint */
554static 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
570bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out)
571{

Callers 1

ParseFixedPointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected