1 commit 69da074d7adfab7b57004a0dea9403a928e310a5
2 Author: Ulrich Drepper <drepper@gmail.com>
3 Date: Wed Nov 10 02:38:35 2010 -0500
5 Fix warnings in __bswap_16.
7 diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h
8 index 1f3fc5e..c246ae8 100644
9 --- a/sysdeps/i386/bits/byteswap.h
10 +++ b/sysdeps/i386/bits/byteswap.h
12 /* Macros to swap the order of bytes in integer values.
13 - Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008
14 + Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008, 2010
15 Free Software Foundation, Inc.
16 This file is part of the GNU C Library.
20 /* Swap bytes in 16 bit value. */
21 #define __bswap_constant_16(x) \
22 - ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
23 + ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
27 # define __bswap_16(x) \
29 - ({ register unsigned short int __v, __x = (x); \
30 + ({ register unsigned short int __v, __x = (unsigned short int) (x); \
31 if (__builtin_constant_p (__x)) \
32 __v = __bswap_constant_16 (__x); \
34 __asm__ ("rorw $8, %w0" \
42 /* This is better than nothing. */
43 # define __bswap_16(x) \
45 - ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
46 + ({ register unsigned short int __x = (unsigned short int) (x); \
47 + __bswap_constant_16 (__x); }))
50 static __inline unsigned short int
51 @@ -122,7 +123,7 @@ __bswap_32 (unsigned int __bsx)
53 ({ union { __extension__ unsigned long long int __ll; \
54 unsigned long int __l[2]; } __w, __r; \
55 - if (__builtin_constant_p (x)) \
56 + if (__builtin_constant_p (x)) \
57 __r.__ll = __bswap_constant_64 (x); \
60 diff --git a/sysdeps/x86_64/bits/byteswap.h b/sysdeps/x86_64/bits/byteswap.h
61 index 08b38e8..e350fb8 100644
62 --- a/sysdeps/x86_64/bits/byteswap.h
63 +++ b/sysdeps/x86_64/bits/byteswap.h
65 /* Macros to swap the order of bytes in integer values.
66 - Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007, 2008
67 + Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007, 2008, 2010
68 Free Software Foundation, Inc.
69 This file is part of the GNU C Library.
73 /* Swap bytes in 16 bit value. */
74 #define __bswap_constant_16(x) \
75 - ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
76 + ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
78 #if defined __GNUC__ && __GNUC__ >= 2
79 # define __bswap_16(x) \
81 - ({ register unsigned short int __v, __x = (x); \
82 + ({ register unsigned short int __v, __x = (unsigned short int) (x); \
83 if (__builtin_constant_p (__x)) \
84 __v = __bswap_constant_16 (__x); \
87 /* This is better than nothing. */
88 # define __bswap_16(x) \
90 - ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
91 + ({ register unsigned short int __x = (unsigned short int) (x); \
92 + __bswap_constant_16 (__x); }))
97 # define __bswap_64(x) \
99 ({ union { __extension__ unsigned long long int __ll; \
100 - unsigned int __l[2]; } __w, __r; \
101 - if (__builtin_constant_p (x)) \
102 - __r.__ll = __bswap_constant_64 (x); \
106 - __r.__l[0] = __bswap_32 (__w.__l[1]); \
107 - __r.__l[1] = __bswap_32 (__w.__l[0]); \
110 + unsigned int __l[2]; } __w, __r; \
111 + if (__builtin_constant_p (x)) \
112 + __r.__ll = __bswap_constant_64 (x); \
116 + __r.__l[0] = __bswap_32 (__w.__l[1]); \
117 + __r.__l[1] = __bswap_32 (__w.__l[0]); \