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

Function parser_read_uint64

dpdk/examples/ip_pipeline/parser.c:80–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80int
81parser_read_uint64(uint64_t *value, const char *p)
82{
83 char *next;
84 uint64_t val;
85
86 p = skip_white_spaces(p);
87 if (!isdigit(*p))
88 return -EINVAL;
89
90 val = strtoul(p, &next, 10);
91 if (p == next)
92 return -EINVAL;
93
94 p = next;
95 switch (*p) {
96 case 'T':
97 val *= 1024ULL;
98 /* fall through */
99 case 'G':
100 val *= 1024ULL;
101 /* fall through */
102 case 'M':
103 val *= 1024ULL;
104 /* fall through */
105 case 'k':
106 case 'K':
107 val *= 1024ULL;
108 p++;
109 break;
110 }
111
112 p = skip_white_spaces(p);
113 if (*p != '\0')
114 return -EINVAL;
115
116 *value = val;
117 return 0;
118}
119
120int
121parser_read_uint64_hex(uint64_t *value, const char *p)

Callers 7

cmd_tmgr_subport_profileFunction · 0.70
cmd_tmgr_pipe_profileFunction · 0.70
cmd_tmgrFunction · 0.70
parser_read_uint32Function · 0.70
parser_read_uint16Function · 0.70
parser_read_uint8Function · 0.70

Calls 2

isdigitFunction · 0.85
strtoulFunction · 0.85

Tested by

no test coverage detected