diff options
author | Martin Ebourne <martin@ebourne.me.uk> | 2006-02-03 00:44:12 +0000 |
---|---|---|
committer | Martin Ebourne <martin@ebourne.me.uk> | 2006-02-03 00:44:12 +0000 |
commit | 20a736e41510ea3deb00e93541490a94d23cdb6c (patch) | |
tree | e7a611110c7d304b6ca0125ecdfc405db10d2ef6 /lib/common | |
parent | a5eaeaa9ff39a5568d9425ec57fd1af5dfe79c90 (diff) |
Beef up configure checks for 64 bit endian swapping function.
NOTE: Needs testing on other platforms, especially BSD.
Diffstat (limited to 'lib/common')
-rw-r--r-- | lib/common/Box.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/common/Box.h b/lib/common/Box.h index c988e296..eb33673c 100644 --- a/lib/common/Box.h +++ b/lib/common/Box.h @@ -134,21 +134,19 @@ inline uint64_t box_swap64(uint64_t x) #ifdef WORDS_BIGENDIAN #define box_hton64(x) (x) #define box_ntoh64(x) (x) -#else +#elif defined(HAVE_BSWAP64) #ifdef HAVE_SYS_ENDIAN_H #include <sys/endian.h> - // betoh64 (OpenBSD) is sometimes called be64toh (FreeBSD, NetBSD). - // Rather than check for it just reuse htobe64 since they are symmetrical - #define box_hton64(x) htobe64(x) - #define box_ntoh64(x) htobe64(x) - #elif HAVE_ASM_BYTEORDER_H + #endif + #ifdef HAVE_ASM_BYTEORDER_H #include <asm/byteorder.h> - #define box_hton64(x) __cpu_to_be64(x) - #define box_ntoh64(x) __be64_to_cpu(x) - #else - #define box_hton64(x) box_swap64(x) - #define box_ntoh64(x) box_swap64(x) #endif + + #define box_hton64(x) BSWAP64(x) + #define box_ntoh64(x) BSWAP64(x) +#else + #define box_hton64(x) box_swap64(x) + #define box_ntoh64(x) box_swap64(x) #endif #endif // BOX__H |