diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-30 21:32:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-30 21:32:10 +0000 |
commit | 3415075bda4992dcef7ea51e29126b4a6b2f001c (patch) | |
tree | 80018eff689be498766c83870bcf161095837c7a /src/util | |
parent | 77c03065a39f869a188b4e2e8cd6a88dc7a02fc8 (diff) | |
download | gnunet-3415075bda4992dcef7ea51e29126b4a6b2f001c.tar.gz gnunet-3415075bda4992dcef7ea51e29126b4a6b2f001c.zip |
-improve byteorder macro checks for FreeBSD
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/common_endian.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/util/common_endian.c b/src/util/common_endian.c index 56aa7b0c4..1867ba01d 100644 --- a/src/util/common_endian.c +++ b/src/util/common_endian.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2003, 2004, 2006 Christian Grothoff (and other contributing authors) | 3 | (C) 2001, 2002, 2003, 2004, 2006, 2012 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -32,20 +32,24 @@ | |||
32 | uint64_t | 32 | uint64_t |
33 | GNUNET_ntohll (uint64_t n) | 33 | GNUNET_ntohll (uint64_t n) |
34 | { | 34 | { |
35 | #if __BYTE_ORDER == __BIG_ENDIAN | 35 | #if __BYTE_ORDER == __BIG_ENDIAN || _BYTE_ORDER == _BIG_ENDIAN |
36 | return n; | 36 | return n; |
37 | #else | 37 | #elif __BYTE_ORDER == __LITTLE_ENDIAN || _BYTE_ORDER == _LITTLE_ENDIAN |
38 | return (((uint64_t) ntohl (n)) << 32) + ntohl (n >> 32); | 38 | return (((uint64_t) ntohl (n)) << 32) + ntohl (n >> 32); |
39 | #else | ||
40 | #error byteorder undefined | ||
39 | #endif | 41 | #endif |
40 | } | 42 | } |
41 | 43 | ||
42 | uint64_t | 44 | uint64_t |
43 | GNUNET_htonll (uint64_t n) | 45 | GNUNET_htonll (uint64_t n) |
44 | { | 46 | { |
45 | #if __BYTE_ORDER == __BIG_ENDIAN | 47 | #if __BYTE_ORDER == __BIG_ENDIAN || _BYTE_ORDER == _BIG_ENDIAN |
46 | return n; | 48 | return n; |
47 | #else | 49 | #elif __BYTE_ORDER == __LITTLE_ENDIAN || _BYTE_ORDER == _LITTLE_ENDIAN |
48 | return (((uint64_t) htonl (n)) << 32) + htonl (n >> 32); | 50 | return (((uint64_t) htonl (n)) << 32) + htonl (n >> 32); |
51 | #else | ||
52 | #error byteorder undefined | ||
49 | #endif | 53 | #endif |
50 | } | 54 | } |
51 | 55 | ||