diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-05 15:16:03 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-05 15:16:03 +0000 |
commit | 33dfaada638d98163e265e46ca527a6630437613 (patch) | |
tree | bef00334a4e0983e2833f19b480b2587cf12d854 /src/util/common_endian.c | |
parent | aa79ba473f5351a046f870601524ba628aaa11b5 (diff) | |
download | gnunet-33dfaada638d98163e265e46ca527a6630437613.tar.gz gnunet-33dfaada638d98163e265e46ca527a6630437613.zip |
-fix
Diffstat (limited to 'src/util/common_endian.c')
-rw-r--r-- | src/util/common_endian.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/util/common_endian.c b/src/util/common_endian.c index 3a1321463..d7e11ac0c 100644 --- a/src/util/common_endian.c +++ b/src/util/common_endian.c | |||
@@ -54,12 +54,11 @@ double | |||
54 | GNUNET_hton_double (double d) | 54 | GNUNET_hton_double (double d) |
55 | { | 55 | { |
56 | double res; | 56 | double res; |
57 | unsigned int *in = (unsigned int *) &d; | 57 | uint64_t *in = (uint64_t *) &d; |
58 | unsigned int *out = (unsigned int *) &res; | 58 | uint64_t *out = (uint64_t *) &res; |
59 | |||
60 | out[0] = GNUNET_htonll(in[0]); | ||
59 | 61 | ||
60 | out[0] = htonl(in[0]); | ||
61 | out[1] = htonl(in[1]); | ||
62 | |||
63 | return res; | 62 | return res; |
64 | } | 63 | } |
65 | 64 | ||
@@ -68,11 +67,10 @@ double | |||
68 | GNUNET_ntoh_double (double d) | 67 | GNUNET_ntoh_double (double d) |
69 | { | 68 | { |
70 | double res; | 69 | double res; |
71 | unsigned int *in = (unsigned int *) &d; | 70 | uint64_t *in = (uint64_t *) &d; |
72 | unsigned int *out = (unsigned int *) &res; | 71 | uint64_t *out = (uint64_t *) &res; |
73 | 72 | ||
74 | out[0] = ntohl(in[0]); | 73 | out[0] = GNUNET_ntohll(in[0]); |
75 | out[1] = ntohl(in[1]); | ||
76 | 74 | ||
77 | return res; | 75 | return res; |
78 | } | 76 | } |