aboutsummaryrefslogtreecommitdiff
path: root/src/util/common_endian.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-05 15:16:03 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-05 15:16:03 +0000
commit33dfaada638d98163e265e46ca527a6630437613 (patch)
treebef00334a4e0983e2833f19b480b2587cf12d854 /src/util/common_endian.c
parentaa79ba473f5351a046f870601524ba628aaa11b5 (diff)
-fix
Diffstat (limited to 'src/util/common_endian.c')
-rw-r--r--src/util/common_endian.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/util/common_endian.c b/src/util/common_endian.c
index 3a13214636..d7e11ac0c0 100644
--- a/src/util/common_endian.c
+++ b/src/util/common_endian.c
@@ -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;
}