diff --git a/include/sys/byteorder.h b/include/sys/byteorder.h index 42fc53fb..7518f587 100644 --- a/include/sys/byteorder.h +++ b/include/sys/byteorder.h @@ -45,11 +45,25 @@ (((uint32_t)BE_IN16(xa) << 16) | BE_IN16((uint8_t *)(xa)+2)) #ifdef _BIG_ENDIAN -#define htonll(x) (x) -#define ntohll(x) (x) +static __inline__ uint64_t +htonll(uint64_t n) { + return (n); +} + +static __inline__ uint64_t +ntohll(uint64_t n){ + return (n); +} #else -#define htonll(x) ((((uint64_t)htonl(x)) << 32) + htonl((x) >> 32)) -#define ntohll(x) ((((uint64_t)ntohl(x)) << 32) + ntohl((x) >> 32)) +static __inline__ uint64_t +htonll(uint64_t n) { + return ((((uint64_t)htonl(n)) << 32) + htonl(n >> 32)); +} + +static __inline__ uint64_t +ntohll(uint64_t n){ + return ((((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32)); +} #endif #endif /* SPL_BYTEORDER_H */