MCPcopy Create free account
hub / github.com/coreboot/coreboot / strtoull

Function strtoull

payloads/libpayload/libc/string.c:408–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

406 */
407
408unsigned long long int strtoull(const char *ptr, char **endptr, int base)
409{
410 unsigned long long int ret = 0;
411
412 if (endptr != NULL)
413 *endptr = (char *) ptr;
414
415 /* Purge whitespace */
416
417 for ( ; *ptr && isspace(*ptr); ptr++);
418
419 if (!*ptr)
420 return 0;
421
422 /* Determine the base */
423
424 if (base == 0) {
425 if (ptr[0] == '0' && (ptr[1] == 'x' || ptr[1] == 'X'))
426 base = 16;
427 else if (ptr[0] == '0') {
428 base = 8;
429 ptr++;
430 } else {
431 base = 10;
432 }
433 }
434
435 /* Base 16 allows the 0x on front - so skip over it */
436
437 if (base == 16) {
438 if (ptr[0] == '0' && (ptr[1] == 'x' || ptr[1] == 'X') &&
439 _valid(ptr[2], base))
440 ptr += 2;
441 }
442
443 for ( ; *ptr && _valid(*ptr, base); ptr++)
444 ret = (ret * base) + _offset(*ptr, base);
445
446 if (endptr != NULL)
447 *endptr = (char *) ptr;
448
449 return ret;
450}
451
452unsigned long int strtoul(const char *ptr, char **endptr, int base)
453{

Callers 13

strtollFunction · 0.70
strtoulFunction · 0.70
set_option_from_stringFunction · 0.50
expr_parse_stringFunction · 0.50
arch_tick_frequencyFunction · 0.50
parse_uintFunction · 0.50
register_amd_psp_fw_addrFunction · 0.50
register_bios_fw_addrFunction · 0.50
register_fw_fuseFunction · 0.50
amdfwtool_getoptFunction · 0.50
prepare_cmos_writeFunction · 0.50
mainFunction · 0.50

Calls 3

_validFunction · 0.85
_offsetFunction · 0.85
isspaceFunction · 0.70

Tested by

no test coverage detected