summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/zebra.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/zebra.h b/lib/zebra.h
index 455db9c64e..a87398a237 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -338,14 +338,13 @@ struct in_pktinfo {
#define strmatch(a,b) (!strcmp((a), (b)))
-#define htonll(x) \
- ((1 == htonl(1)) \
- ? (x) \
- : ((uint64_t)htonl((x)&0xFFFFFFFF) << 32) | htonl((x) >> 32))
-#define ntohll(x) \
- ((1 == ntohl(1)) \
- ? (x) \
- : ((uint64_t)ntohl((x)&0xFFFFFFFF) << 32) | ntohl((x) >> 32))
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define htonll(x) (((uint64_t)htonl((x)&0xFFFFFFFF) << 32) | htonl((x) >> 32))
+#define ntohll(x) (((uint64_t)ntohl((x)&0xFFFFFFFF) << 32) | ntohl((x) >> 32))
+#else
+#define htonll(x) (x)
+#define ntohll(x) (x)
+#endif
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK 0x7f000001 /* Internet address 127.0.0.1. */