The following code is producing a warning when I compile it on 32-bit systems:
1087: warning: integer constant is too large for "long" type
; how can I fix this so I don't get that warning and it works correctly on 32-bit?
A valid input for this is:
unsigned char str[] = "\x00\x17\x7c\x3a\x67\x4e\xcb\x01";
and the mypow function returns unsigned long long.
unsigned long long high, low, nano;
high = // line 1087
(str[7]&0xff) * mypow(2,56) +
(str[6]&0xff) * mypow(2,48) +
(str[5]&0xff) * mypow(2,40) +
(str[4]&0xff) * mypow(2, 32);
low =
(str[3]&0xff) * mypow(2,24) +
(str[2]&0xff) * mypow(2,16) +
(str[1]&0xff) * mypow(2,8) +
(str[0]&0xff);
nano = ((high + low)/10000000) - (unsigned long long)11644473600;
return localtime((time_t*)&nano);