Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
/* Keep it sync with enum in .h */
static const char * num_help[] = {
/* Keep it sync with enum in .h */
static const char * num_help[] = {
- "UINT8", "UINT16", "UINT32",
- "INT8", "INT16", "INT32",
+ "UINT8", "UINT16", "UINT32", "UINT64",
+ "INT8", "INT16", "INT32", "INT64",
#ifdef CMDLINE_HAVE_FLOAT
"FLOAT",
#endif
};
static inline int
#ifdef CMDLINE_HAVE_FLOAT
"FLOAT",
#endif
};
static inline int
-add_to_res(unsigned int c, uint32_t *res, unsigned int base)
+add_to_res(unsigned int c, uint64_t *res, unsigned int base)
- if ( (UINT32_MAX - c) / base < *res ) {
+ if ( (UINT64_MAX - c) / base < *res ) {
- *res = *res * base + c ;
+ *res = (uint64_t) (*res * base + c);
enum num_parse_state_t st = START;
const char * buf = srcbuf;
char c = *buf;
enum num_parse_state_t st = START;
const char * buf = srcbuf;
char c = *buf;
#ifdef CMDLINE_HAVE_FLOAT
#ifdef CMDLINE_HAVE_FLOAT
- uint32_t res2 = 0, res3 = 1;
+ uint64_t res2 = 0, res3 = 1;
#endif
memcpy(&nd, &((struct cmdline_token_num *)tk)->num_data, sizeof(nd));
#endif
memcpy(&nd, &((struct cmdline_token_num *)tk)->num_data, sizeof(nd));
*(uint32_t *)res = (uint32_t) res1;
return (buf-srcbuf);
}
*(uint32_t *)res = (uint32_t) res1;
return (buf-srcbuf);
}
+ else if ( nd.type == UINT64 ) {
+ if (res)
+ *(uint64_t *)res = res1;
+ return (buf-srcbuf);
+ }
#ifdef CMDLINE_HAVE_FLOAT
else if ( nd.type == FLOAT ) {
if (res)
#ifdef CMDLINE_HAVE_FLOAT
else if ( nd.type == FLOAT ) {
if (res)
UINT8 = 0,
UINT16,
UINT32,
UINT8 = 0,
UINT16,
UINT32,
#ifndef NO_PARSE_FLOAT
,FLOAT
#endif
#ifndef NO_PARSE_FLOAT
,FLOAT
#endif