From 2174c6dd8555f654c30df2f8f3321b69e0f736f8 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Thu, 21 Jun 2012 15:49:33 +0200 Subject: Avoid -Wconversion warning for htons --- bits/byteswap-16.h | 3 ++- bits/byteswap.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'bits') diff --git a/bits/byteswap-16.h b/bits/byteswap-16.h index 078dd0e17a..6cc1d30932 100644 --- a/bits/byteswap-16.h +++ b/bits/byteswap-16.h @@ -23,7 +23,8 @@ #ifdef __GNUC__ # define __bswap_16(x) \ (__extension__ \ - ({ unsigned short int __bsx = (x); __bswap_constant_16 (__bsx); })) + ({ unsigned short int __bsx = (unsigned short int) (x); \ + __bswap_constant_16 (__bsx); })) #else static __inline unsigned short int __bswap_16 (unsigned short int __bsx) diff --git a/bits/byteswap.h b/bits/byteswap.h index d818293a4c..3ca0ad6986 100644 --- a/bits/byteswap.h +++ b/bits/byteswap.h @@ -27,7 +27,7 @@ /* Swap bytes in 16 bit value. */ #define __bswap_constant_16(x) \ - ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) + ((unsigned short int)((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8))) /* Get __bswap_16. */ #include -- cgit 1.4.1