-fix
authorChristian Grothoff <christian@grothoff.org>
Thu, 5 Jan 2012 15:16:03 +0000 (15:16 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 5 Jan 2012 15:16:03 +0000 (15:16 +0000)
src/util/common_endian.c

index 3a13214636433aad83b7b315b8ae2b3fa17e0b2f..d7e11ac0c0640b680f6fed810045ee32f9b68cdb 100644 (file)
@@ -54,12 +54,11 @@ double
 GNUNET_hton_double (double d) 
 {
   double res;
-  unsigned int *in = (unsigned int *) &d;
-  unsigned int *out = (unsigned int *) &res;
+  uint64_t *in = (uint64_t *) &d;
+  uint64_t *out = (uint64_t *) &res;
+
+  out[0] = GNUNET_htonll(in[0]);
 
-  out[0] = htonl(in[0]);
-  out[1] = htonl(in[1]);
   return res;
 }
 
@@ -68,11 +67,10 @@ double
 GNUNET_ntoh_double (double d) 
 {
   double res;
-  unsigned int *in = (unsigned int *) &d;
-  unsigned int *out = (unsigned int *) &res;
+  uint64_t *in = (uint64_t *) &d;
+  uint64_t *out = (uint64_t *) &res;
 
-  out[0] = ntohl(in[0]);
-  out[1] = ntohl(in[1]);
+  out[0] = GNUNET_ntohll(in[0]);
  
   return res;
 }