From 9dbe6d3478329df159cf402c1812485649741e7c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 20 Dec 2015 15:54:26 +0100 Subject: It is of course possible that int is 16 bits, and long is required to get 32 bits (in this case, assuming 8-, 16-, and 32-bit integers exists) long must be 32 bits. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/arpa/inet/htonl.c | 6 +++--- src/arpa/inet/ntohl.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/arpa') diff --git a/src/arpa/inet/htonl.c b/src/arpa/inet/htonl.c index 8422fdc..233cc06 100644 --- a/src/arpa/inet/htonl.c +++ b/src/arpa/inet/htonl.c @@ -33,11 +33,11 @@ */ uint32_t _htonl(uint32_t value) { -#if __INT32_BYTEORDER == 0x01020304 +#if __INT32_BYTEORDER == 0x01020304L return value; -#elif __INT32_BYTEORDER == 0x04030201 +#elif __INT32_BYTEORDER == 0x04030201L return (value >> 24) | ((value & 0xFF0000) >> 8) | ((value & 0x00FF00) << 8) | (value << 24); -#elif __INT32_BYTEORDER == 0x02010403 +#elif __INT32_BYTEORDER == 0x02010403L return (value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); #else char rc[4]; diff --git a/src/arpa/inet/ntohl.c b/src/arpa/inet/ntohl.c index 7111c28..b9c3757 100644 --- a/src/arpa/inet/ntohl.c +++ b/src/arpa/inet/ntohl.c @@ -33,11 +33,11 @@ */ uint32_t _ntohl(uint32_t value) { -#if __INT32_BYTEORDER == 0x01020304 +#if __INT32_BYTEORDER == 0x01020304L return value; -#elif __INT32_BYTEORDER == 0x04030201 +#elif __INT32_BYTEORDER == 0x04030201L return (value >> 24) | ((value & 0xFF0000) >> 8) | ((value & 0x00FF00) << 8) | (value << 24); -#elif __INT32_BYTEORDER == 0x02010403 +#elif __INT32_BYTEORDER == 0x02010403L return (value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); #else unsigned char* v = (unsigned char*)&value; -- cgit v1.2.3-70-g09d2