diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-20 15:54:26 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-20 15:54:26 +0100 |
commit | 9dbe6d3478329df159cf402c1812485649741e7c (patch) | |
tree | ea618ce99263b478e94083673e5233719b3fd712 /src/arpa/inet/htonl.c | |
parent | m (diff) | |
download | slibc-9dbe6d3478329df159cf402c1812485649741e7c.tar.gz slibc-9dbe6d3478329df159cf402c1812485649741e7c.tar.bz2 slibc-9dbe6d3478329df159cf402c1812485649741e7c.tar.xz |
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.
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src/arpa/inet/htonl.c')
-rw-r--r-- | src/arpa/inet/htonl.c | 6 |
1 files changed, 3 insertions, 3 deletions
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]; |