diff --git a/headers/posix/netinet/in.h b/headers/posix/netinet/in.h index 1362259613..0e16b70f1f 100644 --- a/headers/posix/netinet/in.h +++ b/headers/posix/netinet/in.h @@ -26,22 +26,21 @@ typedef uint32_t in_addr_t; * and we are not allowed to import all the BeOS types here. */ #ifndef htonl -/* extern uint32_t __swap_int32(uint32_t); */ /* private */ extern unsigned long __swap_int32(unsigned long); /* private */ extern uint16_t __swap_int16(uint16_t); /* private */ - #if BYTE_ORDER == LITTLE_ENDIAN - #define htonl(x) __swap_int32(x) - #define ntohl(x) __swap_int32(x) - #define htons(x) __swap_int16(x) - #define ntohs(x) __swap_int16(x) - #elif BYTE_ORDER == BIG_ENDIAN - #define htonl(x) (x) - #define ntohl(x) (x) - #define htons(x) (x) - #define ntohs(x) (x) - #else - #error Unknown byte order. - #endif +# if BYTE_ORDER == LITTLE_ENDIAN +# define htonl(x) ((uint32_t)__swap_int32(x)) +# define ntohl(x) ((uint32_t)__swap_int32(x)) +# define htons(x) __swap_int16(x) +# define ntohs(x) __swap_int16(x) +# elif BYTE_ORDER == BIG_ENDIAN +# define htonl(x) (x) +# define ntohl(x) (x) +# define htons(x) (x) +# define ntohs(x) (x) +# else +# error Unknown byte order. +# endif #endif