Lib/WASTParse/ParseNumbers.cpp
static U64 parseDecimalUnsignedInt(const char*& nextChar,
								   ParseState* parseState,
								   U64 maxValue,
								   const char* context)
{
	U64 result = 0;
	const char* firstDigit = nextChar;
	while(true)
	{
		if(*nextChar == '_')
		{
			++nextChar;
			continue;
		}
		if(*nextChar < '0' || *nextChar > '9') { break; }

		const U8 digit = *nextChar - '0';
		++nextChar;

		if(result > U64(maxValue - digit) / 10)
		{
			parseErrorf(parseState, firstDigit, "%s is too large", context);
			result = maxValue;
			while((*nextChar >= '0' && *nextChar <= '9') || *nextChar == '_') { ++nextChar; };
			break;
		}
		WAVM_ASSERT(result * 10 + digit >= result);
		result = result * 10 + digit;
	};
	return result;
}
// Parses an unsigned integer from digits, advancing nextChar past the parsed digits.
// Assumes it will only be called for input that's already been accepted by the lexer as a decimal
// integer.
Parses an unsigned integer from digits, advancing nextChar past the parsed digits.
Assumes it will only be called for input that's already been accepted by the lexer as a decimal
integer.
Parses an unsigned integer from digits advancing nextChar past the parsed digits . Assumes it will only be called for input that ' s already been accepted by the lexer as a decimal integer .
static U64 parseDecimalUnsignedInt(const char*& nextChar,
								   ParseState* parseState,
								   U64 maxValue,
								   const char* context)
{
	U64 result = 0;
	const char* firstDigit = nextChar;
	while(true)
	{
		if(*nextChar == '_')
		{
			++nextChar;
			continue;
		}
		if(*nextChar < '0' || *nextChar > '9') { break; }
		const U8 digit = *nextChar - '0';
		++nextChar;
		if(result > U64(maxValue - digit) / 10)
		{
			parseErrorf(parseState, firstDigit, "%s is too large", context);
			result = maxValue;
			while((*nextChar >= '0' && *nextChar <= '9') || *nextChar == '_') { ++nextChar; };
			break;
		}
		WAVM_ASSERT(result * 10 + digit >= result);
		result = result * 10 + digit;
	};
	return result;
}
static U64 parseDecimalUnsignedInt ( const char * & nextChar , ParseState * parseState , U64 maxValue , const char * context ) { U64 result = 0 ; const char * firstDigit = nextChar ; while ( true ) { if ( * nextChar == ' ' ) { ++ nextChar ; continue ; } if ( * nextChar < ' ' || * nextChar > ' ' ) { break ; } const U8 digit = * nextChar - ' ' ; ++ nextChar ; if ( result > U64 ( maxValue - digit ) / 10 ) { parseErrorf ( parseState , firstDigit , " " , context ) ; result = maxValue ; while ( ( * nextChar >= ' ' && * nextChar <= ' ' ) || * nextChar == ' ' ) { ++ nextChar ; } ; break ; } WAVM_ASSERT ( result * 10 + digit >= result ) ; result = result * 10 + digit ; } ; return result ; }
Parses an unsigned integer from digits, advancing nextChar past the parsed digits.
Parses an unsigned integer from digits advancing nextChar past the parsed digits .