MCPcopy Create free account
hub / github.com/F-Stack/f-stack / parser_read_uint64

Function parser_read_uint64

dpdk/examples/fips_validation/fips_validation.c:756–794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

754}
755
756static int
757parser_read_uint64(uint64_t *value, const char *p)
758{
759 char *next;
760 uint64_t val;
761
762 p = skip_white_spaces(p);
763 if (!isdigit(*p))
764 return -EINVAL;
765
766 val = strtoul(p, &next, 10);
767 if (p == next)
768 return -EINVAL;
769
770 p = next;
771 switch (*p) {
772 case 'T':
773 val *= 1024ULL;
774 /* fall through */
775 case 'G':
776 val *= 1024ULL;
777 /* fall through */
778 case 'M':
779 val *= 1024ULL;
780 /* fall through */
781 case 'k':
782 case 'K':
783 val *= 1024ULL;
784 p++;
785 break;
786 }
787
788 p = skip_white_spaces(p);
789 if (*p != '\0')
790 return -EINVAL;
791
792 *value = val;
793 return 0;
794}
795
796int
797parser_read_uint32(uint32_t *value, char *p)

Callers 2

parser_read_uint32Function · 0.70
parser_read_uint16Function · 0.70

Calls 2

isdigitFunction · 0.85
strtoulFunction · 0.85

Tested by

no test coverage detected