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