MCPcopy Create free account
hub / github.com/anjo76/angelscript / asCharToNbr

Function asCharToNbr

sdk/angelscript/source/as_string_util.cpp:165–171  ·  view source on GitHub ↗

Converts a character to the decimal number based on the radix Returns -1 if the character is not valid for the radix

Source from the content-addressed store, hash-verified

163// Converts a character to the decimal number based on the radix
164// Returns -1 if the character is not valid for the radix
165static int asCharToNbr(char ch, int radix)
166{
167 if( ch >= '0' && ch <= '9' ) return ((ch -= '0') < radix ? ch : -1);
168 if( ch >= 'A' && ch <= 'Z' ) return ((ch -= 'A'-10) < radix ? ch : -1);
169 if( ch >= 'a' && ch <= 'z' ) return ((ch -= 'a'-10) < radix ? ch : -1);
170 return -1;
171}
172
173// If base is 0 the string should be prefixed by 0x, 0d, 0o, or 0b to allow the function to automatically determine the radix
174asQWORD asStringScanUInt64(const char *string, int base, size_t *numScanned, bool *overflow)

Callers 1

asStringScanUInt64Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected