/* 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
-add_to_res(unsigned int c, uint32_t *res, unsigned int base)
+add_to_res(unsigned int c, uint64_t *res, unsigned int base)
{
/* overflow */
- if ( (UINT32_MAX - c) / base < *res ) {
+ if ( (UINT64_MAX - c) / base < *res ) {
return -1;
}
- *res = *res * base + c ;
+ *res = (uint64_t) (*res * base + c);
return 0;
}
enum num_parse_state_t st = START;
const char * buf = srcbuf;
char c = *buf;
- uint32_t res1 = 0;
+ uint64_t res1 = 0;
#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));
*(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)