MCPcopy Create free account
hub / github.com/LUX-Core/lux / ProcessMantissaDigit

Function ProcessMantissaDigit

src/utilstrencodings.cpp:643–657  ·  view source on GitHub ↗

Helper function for ParseFixedPoint */

Source from the content-addressed store, hash-verified

641
642/** Helper function for ParseFixedPoint */
643static 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
659bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out)
660{

Callers 1

ParseFixedPointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected