64-bit arithmetic does not seem to work on TI compiler for CC1310 (ARM Cortex M-3). In particular, in the following code v remain always zero (x gets correct values):
#include <stdint.h>
...
uint64_t getUint64(const uint8_t* field, uint16_t len) {
uint64_t v = 0;
uint64_t x;
uint16_t i;
uint8_t shift = 0;
for (i=0; i<len; i++) {
System_printf("%02x\n",field[i]);
x = field[i];
x <<= shift;
v = v | x;
System_printf("%02x %08x %08x\n",field[i],x,v);
shift += 8;
}
System_printf("get64 %d\n",v);
return v;
}
v remains zero throughout. The values of x seem fine (byte values shifted to the left). When I change both v and x to uint32_t, v gets the correct value (when fed from exactly the same data).
Is this just broken or is there a compiler switch that enables 64-bit arithmetic?
Thanks, Sivan Toledo