|
|
b40826 |
commit 69da074d7adfab7b57004a0dea9403a928e310a5
|
|
|
b40826 |
Author: Ulrich Drepper <drepper@gmail.com>
|
|
|
b40826 |
Date: Wed Nov 10 02:38:35 2010 -0500
|
|
|
b40826 |
|
|
|
b40826 |
Fix warnings in __bswap_16.
|
|
|
b40826 |
|
|
|
b40826 |
diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h
|
|
|
b40826 |
index 1f3fc5e..c246ae8 100644
|
|
|
b40826 |
--- a/sysdeps/i386/bits/byteswap.h
|
|
|
b40826 |
+++ b/sysdeps/i386/bits/byteswap.h
|
|
|
b40826 |
@@ -1,5 +1,5 @@
|
|
|
b40826 |
/* Macros to swap the order of bytes in integer values.
|
|
|
b40826 |
- Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008
|
|
|
b40826 |
+ Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008, 2010
|
|
|
b40826 |
Free Software Foundation, Inc.
|
|
|
b40826 |
This file is part of the GNU C Library.
|
|
|
b40826 |
|
|
|
b40826 |
@@ -27,26 +27,27 @@
|
|
|
b40826 |
|
|
|
b40826 |
/* Swap bytes in 16 bit value. */
|
|
|
b40826 |
#define __bswap_constant_16(x) \
|
|
|
b40826 |
- ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
|
|
|
b40826 |
+ ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
|
|
|
b40826 |
|
|
|
b40826 |
#ifdef __GNUC__
|
|
|
b40826 |
# if __GNUC__ >= 2
|
|
|
b40826 |
# define __bswap_16(x) \
|
|
|
b40826 |
(__extension__ \
|
|
|
b40826 |
- ({ register unsigned short int __v, __x = (x); \
|
|
|
b40826 |
+ ({ register unsigned short int __v, __x = (unsigned short int) (x); \
|
|
|
b40826 |
if (__builtin_constant_p (__x)) \
|
|
|
b40826 |
__v = __bswap_constant_16 (__x); \
|
|
|
b40826 |
else \
|
|
|
b40826 |
__asm__ ("rorw $8, %w0" \
|
|
|
b40826 |
: "=r" (__v) \
|
|
|
b40826 |
- : "0" (__x) \
|
|
|
b40826 |
- : "cc"); \
|
|
|
b40826 |
+ : "0" (__x) \
|
|
|
b40826 |
+ : "cc"); \
|
|
|
b40826 |
__v; }))
|
|
|
b40826 |
# else
|
|
|
b40826 |
/* This is better than nothing. */
|
|
|
b40826 |
# define __bswap_16(x) \
|
|
|
b40826 |
(__extension__ \
|
|
|
b40826 |
- ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
|
|
|
b40826 |
+ ({ register unsigned short int __x = (unsigned short int) (x); \
|
|
|
b40826 |
+ __bswap_constant_16 (__x); }))
|
|
|
b40826 |
# endif
|
|
|
b40826 |
#else
|
|
|
b40826 |
static __inline unsigned short int
|
|
|
b40826 |
@@ -122,7 +123,7 @@ __bswap_32 (unsigned int __bsx)
|
|
|
b40826 |
(__extension__ \
|
|
|
b40826 |
({ union { __extension__ unsigned long long int __ll; \
|
|
|
b40826 |
unsigned long int __l[2]; } __w, __r; \
|
|
|
b40826 |
- if (__builtin_constant_p (x)) \
|
|
|
b40826 |
+ if (__builtin_constant_p (x)) \
|
|
|
b40826 |
__r.__ll = __bswap_constant_64 (x); \
|
|
|
b40826 |
else \
|
|
|
b40826 |
{ \
|
|
|
b40826 |
diff --git a/sysdeps/x86_64/bits/byteswap.h b/sysdeps/x86_64/bits/byteswap.h
|
|
|
b40826 |
index 08b38e8..e350fb8 100644
|
|
|
b40826 |
--- a/sysdeps/x86_64/bits/byteswap.h
|
|
|
b40826 |
+++ b/sysdeps/x86_64/bits/byteswap.h
|
|
|
b40826 |
@@ -1,5 +1,5 @@
|
|
|
b40826 |
/* Macros to swap the order of bytes in integer values.
|
|
|
b40826 |
- Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007, 2008
|
|
|
b40826 |
+ Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007, 2008, 2010
|
|
|
b40826 |
Free Software Foundation, Inc.
|
|
|
b40826 |
This file is part of the GNU C Library.
|
|
|
b40826 |
|
|
|
b40826 |
@@ -29,12 +29,12 @@
|
|
|
b40826 |
|
|
|
b40826 |
/* Swap bytes in 16 bit value. */
|
|
|
b40826 |
#define __bswap_constant_16(x) \
|
|
|
b40826 |
- ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
|
|
|
b40826 |
+ ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
|
|
|
b40826 |
|
|
|
b40826 |
#if defined __GNUC__ && __GNUC__ >= 2
|
|
|
b40826 |
# define __bswap_16(x) \
|
|
|
b40826 |
(__extension__ \
|
|
|
b40826 |
- ({ register unsigned short int __v, __x = (x); \
|
|
|
b40826 |
+ ({ register unsigned short int __v, __x = (unsigned short int) (x); \
|
|
|
b40826 |
if (__builtin_constant_p (__x)) \
|
|
|
b40826 |
__v = __bswap_constant_16 (__x); \
|
|
|
b40826 |
else \
|
|
|
b40826 |
@@ -47,7 +47,8 @@
|
|
|
b40826 |
/* This is better than nothing. */
|
|
|
b40826 |
# define __bswap_16(x) \
|
|
|
b40826 |
(__extension__ \
|
|
|
b40826 |
- ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
|
|
|
b40826 |
+ ({ register unsigned short int __x = (unsigned short int) (x); \
|
|
|
b40826 |
+ __bswap_constant_16 (__x); }))
|
|
|
b40826 |
#endif
|
|
|
b40826 |
|
|
|
b40826 |
|
|
|
b40826 |
@@ -120,16 +121,16 @@
|
|
|
b40826 |
# define __bswap_64(x) \
|
|
|
b40826 |
(__extension__ \
|
|
|
b40826 |
({ union { __extension__ unsigned long long int __ll; \
|
|
|
b40826 |
- unsigned int __l[2]; } __w, __r; \
|
|
|
b40826 |
- if (__builtin_constant_p (x)) \
|
|
|
b40826 |
- __r.__ll = __bswap_constant_64 (x); \
|
|
|
b40826 |
- else \
|
|
|
b40826 |
- { \
|
|
|
b40826 |
- __w.__ll = (x); \
|
|
|
b40826 |
- __r.__l[0] = __bswap_32 (__w.__l[1]); \
|
|
|
b40826 |
- __r.__l[1] = __bswap_32 (__w.__l[0]); \
|
|
|
b40826 |
- } \
|
|
|
b40826 |
- __r.__ll; }))
|
|
|
b40826 |
+ unsigned int __l[2]; } __w, __r; \
|
|
|
b40826 |
+ if (__builtin_constant_p (x)) \
|
|
|
b40826 |
+ __r.__ll = __bswap_constant_64 (x); \
|
|
|
b40826 |
+ else \
|
|
|
b40826 |
+ { \
|
|
|
b40826 |
+ __w.__ll = (x); \
|
|
|
b40826 |
+ __r.__l[0] = __bswap_32 (__w.__l[1]); \
|
|
|
b40826 |
+ __r.__l[1] = __bswap_32 (__w.__l[0]); \
|
|
|
b40826 |
+ } \
|
|
|
b40826 |
+ __r.__ll; }))
|
|
|
b40826 |
# endif
|
|
|
b40826 |
#endif
|
|
|
b40826 |
|