|
Source manager | |
|
Elenco funzioni : Clear_Scree Client_WP CounterInPh doubleNB ShelldiWindow MontaDischiLinu CriptaHTM ClearScreenPytho FunzionePin OpenAndClos N.A.K Bluetooth Finde calcolatrice! Lascia il tuo sorgente |
Autore : SDNS[at]hackroom[dot]org
/*Questa funzione permette la conversione di un double in NBO e vice versa*/ #include <endian.h> #if __BYTE_ORDER == __BIG_ENDIAN #define htond(c) (c); #define ntohd(c) (c); #else #if __BYTE_ORDER == __LITTLE_ENDIAN #define htond(c) byteswap(c); #define ntohd(c) byteswap(c); #endif #endif double byteswap(double c) { int k = 0, i = 0; char rev[sizeof(double)], buf[sizeof(double)]; memcpy(buf, &c, sizeof(double)); for(k = 0, i = (sizeof(double)-1); k < sizeof(double); k++, i--) rev[k] = buf[i]; memcpy(&c, rev, sizeof(double)); return(c); } |