could somebody pls tell me how to convert double precision into network byte ordering. i tried
uint32_t htonl(uint32_t hostlong);
uint16_t htons(uint16_t hostshort);
uint32_t ntohl(uint32_t netlong);
uint16_t ntohs(uint16_t netshort);
functions and they worked well but no of them does double (float) conversion cuz these types are apart different on every architecture. And through the XDR i found double-float precision format representations(https://en.wikipedia.org/wiki/Double_precision) but no byte ordering there.
So, i would much appreciate if somebody helps me out on this (C code would be great!). NOTE: OS is Linux kernel (2.6.29), ARMv7 CPU architecture.
A bytewise permutation from source to target data would be the most simple way.
Code:
for (i=0;i<8;i++)
*((char *)&target+i) = *((char *)&source+7-i);
To take advantage from a possibly more effective implementation of htonl() you can apply it crosswise between upper and lower long part of source and target.