summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-01-02 02:25:29 +0000
committerRoland McGrath <roland@gnu.org>2002-01-02 02:25:29 +0000
commit31346bb69e39e92b6228e01c75d787507d486b19 (patch)
tree937a3264bd5c4d0e9ebcea49b5b367fc8d8a31b9
parent72695b630154ecf2c356cde0214e8e9292d77593 (diff)
2002-01-01 Roland McGrath <roland@frob.com>
* nbd.c (htonll): Make this a macro using bswap_64 from <byteswap.h>.
-rw-r--r--libstore/nbd.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/libstore/nbd.c b/libstore/nbd.c
index 99db2a8f..ccd910fa 100644
--- a/libstore/nbd.c
+++ b/libstore/nbd.c
@@ -72,20 +72,14 @@ struct nbd_reply
/* i/o functions. */
-static inline uint64_t
-htonll (uint64_t x)
-{
#if BYTE_ORDER == BIG_ENDIAN
- return x;
+# define htonll(x) (x)
#elif BYTE_ORDER == LITTLE_ENDIAN
- union { uint64_t ll; uint32_t l[2]; } u;
- u.l[0] = htonl ((uint32_t) (x >> 32));
- u.l[1] = htonl ((uint32_t) x);
- return u.ll;
+# include <byteswap.h>
+# define htonll(x) (bswap_64 (x))
#else
# error what endian?
#endif
-}
#define ntohll htonll