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

Function parser_read_uint64

dpdk/examples/pipeline/cli.c:56–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54})
55
56static int
57parser_read_uint64(uint64_t *value, const char *p)
58{
59 char *next;
60 uint64_t val;
61
62 p = skip_white_spaces(p);
63 if (!isdigit(*p))
64 return -EINVAL;
65
66 val = strtoul(p, &next, 0);
67 if (p == next)
68 return -EINVAL;
69
70 p = next;
71 switch (*p) {
72 case 'T':
73 val *= 1024ULL;
74 /* fall through */
75 case 'G':
76 val *= 1024ULL;
77 /* fall through */
78 case 'M':
79 val *= 1024ULL;
80 /* fall through */
81 case 'k':
82 case 'K':
83 val *= 1024ULL;
84 p++;
85 break;
86 }
87
88 p = skip_white_spaces(p);
89 if (*p != '\0')
90 return -EINVAL;
91
92 *value = val;
93 return 0;
94}
95
96static int
97parser_read_uint32(uint32_t *value, const char *p)

Callers 3

parser_read_uint32Function · 0.70
cmd_pipeline_regwrFunction · 0.70

Calls 2

isdigitFunction · 0.85
strtoulFunction · 0.85

Tested by

no test coverage detected