MCPcopy Create free account
hub / github.com/ElementsProject/elements / ProcessMantissaDigit

Function ProcessMantissaDigit

src/util/strencodings.cpp:382–396  ·  view source on GitHub ↗

Helper function for ParseFixedPoint */

Source from the content-addressed store, hash-verified

380
381/** Helper function for ParseFixedPoint */
382static 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
398bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out)
399{

Callers 1

ParseFixedPointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected