MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / SDL_ScanUnsignedLongLong

Function SDL_ScanUnsignedLongLong

deps/SDL2/src/stdlib/SDL_string.c:198–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196
197#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOULL)
198static size_t
199SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 * valuep)
200{
201 const char *textstart = text;
202 Uint64 value = 0;
203
204 if (radix == 16 && SDL_strncmp(text, "0x", 2) == 0) {
205 text += 2;
206 }
207 for (;;) {
208 int v;
209 if (SDL_isdigit((unsigned char) *text)) {
210 v = *text - '0';
211 } else if (radix == 16 && SDL_isupperhex(*text)) {
212 v = 10 + (*text - 'A');
213 } else if (radix == 16 && SDL_islowerhex(*text)) {
214 v = 10 + (*text - 'a');
215 } else {
216 break;
217 }
218 value *= radix;
219 value += v;
220 ++text;
221 }
222 if (valuep && text > textstart) {
223 *valuep = value;
224 }
225 return (text - textstart);
226}
227#endif
228
229#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOD)

Callers 2

SDL_strtoullFunction · 0.85
SDL_vsscanfFunction · 0.85

Calls 2

SDL_strncmpFunction · 0.85
SDL_isdigitFunction · 0.85

Tested by

no test coverage detected