about summary refs log tree commit diff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2010-11-10 02:38:35 -0500
committerUlrich Drepper <drepper@gmail.com>2010-11-10 02:38:35 -0500
commit69da074d7adfab7b57004a0dea9403a928e310a5 (patch)
tree368a360d856a706b0339a864e5efbe0463572985 /sysdeps/i386
parentff02d5280bf252e86d325ff4348feaf531ede831 (diff)
downloadglibc-69da074d7adfab7b57004a0dea9403a928e310a5.tar.gz
glibc-69da074d7adfab7b57004a0dea9403a928e310a5.tar.xz
glibc-69da074d7adfab7b57004a0dea9403a928e310a5.zip
Fix warnings in __bswap_16.
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/bits/byteswap.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h
index 1f3fc5e524..c246ae86c6 100644
--- a/sysdeps/i386/bits/byteswap.h
+++ b/sysdeps/i386/bits/byteswap.h
@@ -1,5 +1,5 @@
 /* Macros to swap the order of bytes in integer values.
-   Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008
+   Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -27,26 +27,27 @@
 
 /* Swap bytes in 16 bit value.  */
 #define __bswap_constant_16(x) \
-     ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
+     ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
 
 #ifdef __GNUC__
 # if __GNUC__ >= 2
 #  define __bswap_16(x) \
      (__extension__							      \
-      ({ register unsigned short int __v, __x = (x);			      \
+      ({ register unsigned short int __v, __x = (unsigned short int) (x);     \
 	 if (__builtin_constant_p (__x))				      \
 	   __v = __bswap_constant_16 (__x);				      \
 	 else								      \
 	   __asm__ ("rorw $8, %w0"					      \
 		    : "=r" (__v)					      \
- 		    : "0" (__x)						      \
- 		    : "cc");						      \
+		    : "0" (__x)						      \
+		    : "cc");						      \
 	 __v; }))
 # else
 /* This is better than nothing.  */
 #  define __bswap_16(x) \
      (__extension__							      \
-      ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
+      ({ register unsigned short int __x = (unsigned short int) (x);	      \
+	 __bswap_constant_16 (__x); }))
 # endif
 #else
 static __inline unsigned short int
@@ -122,7 +123,7 @@ __bswap_32 (unsigned int __bsx)
      (__extension__							      \
       ({ union { __extension__ unsigned long long int __ll;		      \
 		 unsigned long int __l[2]; } __w, __r;			      \
-         if (__builtin_constant_p (x))					      \
+	 if (__builtin_constant_p (x))					      \
 	   __r.__ll = __bswap_constant_64 (x);				      \
 	 else								      \
 	   {								      \