[Buildroot] word swapping doubles on little endian

Christopher Taylor chtaylo3 at gmail.com
Mon Jun 2 20:08:11 UTC 2008

For some reason, when I write a double to file I'm getting byte
swapped then word swapped.

double value = 2.048;
printf("%llx", value);
write(&value,sizeof(double), 1, fd);

on a bigendian I'm getting
printf:  4000 624d d2f1 a9fc

on a little endian I'm getting
printf:  d2f1 a9fc 4000 624d
write:  4d62 0040 fca9 f1d2

whereas I would expect on the little endian write:
fca9 f1d2 4d62 0040

any ideas how this is getting screwed up?


More information about the buildroot mailing list