aboutsummaryrefslogtreecommitdiffstats
path: root/com32/include/netinet/in.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-08-12 21:37:29 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-08-12 21:37:29 -0700
commitff30d914fe20fd5e4743b906ecfe0239f1c4e013 (patch)
tree398f815c82e19f514c9c15d289dc17b1853e76f0 /com32/include/netinet/in.h
parenta1fc1f47b4e6080edabb517a070e3c1918c1b3a1 (diff)
downloadsyslinux-ff30d914fe20fd5e4743b906ecfe0239f1c4e013.tar.gz
syslinux-ff30d914fe20fd5e4743b906ecfe0239f1c4e013.tar.xz
syslinux-ff30d914fe20fd5e4743b906ecfe0239f1c4e013.zip
netinet/in.h: put in explicit casts for all the hton/ntoh macros
For the macro versions of hton/ntoh, use casts everywhere. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/include/netinet/in.h')
-rw-r--r--com32/include/netinet/in.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/com32/include/netinet/in.h b/com32/include/netinet/in.h
index 97458bf9..9c5173be 100644
--- a/com32/include/netinet/in.h
+++ b/com32/include/netinet/in.h
@@ -5,7 +5,7 @@
#include <stdint.h>
-#define __htons_macro(v) (((v) << 8) | ((v) >> 8))
+#define __htons_macro(v) (((uint16_t)(v) << 8) | ((uint16_t)(v) >> 8))
static inline uint16_t __htons(uint16_t v)
{
@@ -15,10 +15,10 @@ static inline uint16_t __htons(uint16_t v)
#define htons(x) (__builtin_constant_p(x) ? __htons_macro(x) : __htons(x))
#define ntohs(x) htons(x)
-#define __htonl_macro(v) ((((v) & 0x000000ff) << 24) | \
- (((v) & 0x0000ff00) << 8) | \
- (((v) & 0x00ff0000) >> 8) | \
- (((v) & 0xff000000) >> 24))
+#define __htonl_macro(v) ((((uint32_t)(v) & 0x000000ff) << 24) | \
+ (((uint32_t)(v) & 0x0000ff00) << 8) | \
+ (((uint32_t)(v) & 0x00ff0000) >> 8) | \
+ (((uint32_t)(v) & 0xff000000) >> 24))
static inline uint32_t __htonl(uint32_t v)
{
@@ -35,7 +35,7 @@ static inline uint32_t __htonl(uint32_t v)
#define __htonq_macro(v) \
(((uint64_t)__htonl_macro((uint32_t)(v)) << 32) | \
- (__htonl_macro((uint32_t)((v) >> 32))))
+ (__htonl_macro((uint32_t)((uint64_t)(v) >> 32))))
static inline uint64_t __htonq(uint64_t v)
{