Add __bswap_64 definition for non GCC compilers.
[BZ#13926] Currently __bswap_64 is not defined at all for non-GCC compilers. Define it but guard it with __GLIBC_HAVE_LONG_LONG. endian.h uses __bswap_64, make the functions only available if __GLIBC_HAVE_LONG_LONG is defined.
This commit is contained in:
parent
39c59c3572
commit
b1aa60f32d
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
||||
2012-04-03 Andreas Jaeger <aj@suse.de>
|
||||
|
||||
[BZ #13926]
|
||||
* sysdeps/i386/bits/byteswap.h [!__GNUC__](__bswap_constant_64):
|
||||
New macro for this case.
|
||||
[!__GNUC__] (__bswap_64): New inline function for this case.
|
||||
* sysdeps/x86_64/bits/byteswap.h: Likewise.
|
||||
* bits/byteswap.h: Likewise.
|
||||
* sysdeps/s390/bits/byteswap.h: [!__GNUC__] (__bswap_64): Use
|
||||
ull, guard with __GLIBC_HAVE_LONG_LONG.
|
||||
|
||||
* string/endian.h (htobe64,htole64,be64toh,le64toh): Guard with
|
||||
__GLIBC_HAVE_LONG_LONG.
|
||||
|
||||
* string/byteswap.h (bswap_64): Guard with __GLIBC_HAVE_LONG_LONG.
|
||||
Include <features.h> for __GLIBC_HAVE_LONG_LONG.
|
||||
|
||||
2012-04-02 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
|
||||
|
||||
[BZ #13691]
|
||||
|
3
NEWS
3
NEWS
@ -18,7 +18,8 @@ Version 2.16
|
||||
13618, 13637, 13656, 13658, 13673, 13691, 13695, 13704, 13706, 13726,
|
||||
13738, 13760, 13761, 13786, 13792, 13806, 13824, 13840, 13841, 13844,
|
||||
13846, 13851, 13852, 13854, 13871, 13879, 13883, 13892, 13910, 13911,
|
||||
13912, 13913, 13915, 13916, 13917, 13918, 13919, 13920, 13921, 13928
|
||||
13912, 13913, 13915, 13916, 13917, 13918, 13919, 13920, 13921, 13926,
|
||||
13928
|
||||
|
||||
* ISO C11 support:
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Macros to swap the order of bytes in integer values.
|
||||
Copyright (C) 1997,1998,2000-2002,2005,2008,2011
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -82,6 +81,22 @@ __bswap_32 (unsigned int __bsx)
|
||||
__r.__l[1] = __bswap_32 (__w.__l[0]); \
|
||||
} \
|
||||
__r.__ll; }))
|
||||
#elif __GLIBC_HAVE_LONG_LONG
|
||||
# define __bswap_constant_64(x) \
|
||||
((((x) & 0xff00000000000000ull) >> 56) \
|
||||
| (((x) & 0x00ff000000000000ull) >> 40) \
|
||||
| (((x) & 0x0000ff0000000000ull) >> 24) \
|
||||
| (((x) & 0x000000ff00000000ull) >> 8) \
|
||||
| (((x) & 0x00000000ff000000ull) << 8) \
|
||||
| (((x) & 0x0000000000ff0000ull) << 24) \
|
||||
| (((x) & 0x000000000000ff00ull) << 40) \
|
||||
| (((x) & 0x00000000000000ffull) << 56))
|
||||
|
||||
static __inline unsigned long long int
|
||||
__bswap_64 (unsigned long long int __bsx)
|
||||
{
|
||||
return __bswap_constant_64 (__bsx);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BITS_BYTESWAP_H */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1997, 2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -18,6 +18,8 @@
|
||||
#ifndef _BYTESWAP_H
|
||||
#define _BYTESWAP_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
/* Get the machine specific, optimized definitions. */
|
||||
#include <bits/byteswap.h>
|
||||
|
||||
@ -31,7 +33,7 @@
|
||||
/* Return a value with all bytes in the 32 bit argument swapped. */
|
||||
#define bswap_32(x) __bswap_32 (x)
|
||||
|
||||
#if defined __GNUC__ && __GNUC__ >= 2
|
||||
#if __GLIBC_HAVE_LONG_LONG
|
||||
/* Return a value with all bytes in the 64 bit argument swapped. */
|
||||
# define bswap_64(x) __bswap_64 (x)
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1992, 1996, 1997, 2000, 2008 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1992-2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -70,10 +70,13 @@
|
||||
# define be32toh(x) __bswap_32 (x)
|
||||
# define le32toh(x) (x)
|
||||
|
||||
# define htobe64(x) __bswap_64 (x)
|
||||
# define htole64(x) (x)
|
||||
# define be64toh(x) __bswap_64 (x)
|
||||
# define le64toh(x) (x)
|
||||
# if __GLIBC_HAVE_LONG_LONG
|
||||
# define htobe64(x) __bswap_64 (x)
|
||||
# define htole64(x) (x)
|
||||
# define be64toh(x) __bswap_64 (x)
|
||||
# define le64toh(x) (x)
|
||||
# endif
|
||||
|
||||
# else
|
||||
# define htobe16(x) (x)
|
||||
# define htole16(x) __bswap_16 (x)
|
||||
@ -85,10 +88,12 @@
|
||||
# define be32toh(x) (x)
|
||||
# define le32toh(x) __bswap_32 (x)
|
||||
|
||||
# define htobe64(x) (x)
|
||||
# define htole64(x) __bswap_64 (x)
|
||||
# define be64toh(x) (x)
|
||||
# define le64toh(x) __bswap_64 (x)
|
||||
# if __GLIBC_HAVE_LONG_LONG
|
||||
# define htobe64(x) (x)
|
||||
# define htole64(x) __bswap_64 (x)
|
||||
# define be64toh(x) (x)
|
||||
# define le64toh(x) __bswap_64 (x)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Macros to swap the order of bytes in integer values.
|
||||
Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008, 2010, 2011
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -131,6 +130,22 @@ __bswap_32 (unsigned int __bsx)
|
||||
__r.__l[1] = __bswap_32 (__w.__l[0]); \
|
||||
} \
|
||||
__r.__ll; }))
|
||||
#elif __GLIBC_HAVE_LONG_LONG
|
||||
# define __bswap_constant_64(x) \
|
||||
((((x) & 0xff00000000000000ull) >> 56) \
|
||||
| (((x) & 0x00ff000000000000ull) >> 40) \
|
||||
| (((x) & 0x0000ff0000000000ull) >> 24) \
|
||||
| (((x) & 0x000000ff00000000ull) >> 8) \
|
||||
| (((x) & 0x00000000ff000000ull) << 8) \
|
||||
| (((x) & 0x0000000000ff0000ull) << 24) \
|
||||
| (((x) & 0x000000000000ff00ull) << 40) \
|
||||
| (((x) & 0x00000000000000ffull) << 56))
|
||||
|
||||
static __inline unsigned long long int
|
||||
__bswap_64 (unsigned long long int __bsx)
|
||||
{
|
||||
return __bswap_constant_64 (__bsx);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BITS_BYTESWAP_H */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Macros to swap the order of bytes in integer values. s390 version.
|
||||
Copyright (C) 2000-2003, 2008, 2011 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000-2003, 2008, 2011, 2012 Free Software Foundation, Inc.
|
||||
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@ -150,16 +150,16 @@ __bswap_32 (unsigned int __bsx)
|
||||
__r.__l[1] = __bswap_32 (__w.__l[0]); \
|
||||
__r.__ll; })
|
||||
# endif
|
||||
#else
|
||||
#elif __GLIBC_HAVE_LONG_LONG
|
||||
# define __bswap_constant_64(x) \
|
||||
((((x) & 0xff00000000000000ul) >> 56) \
|
||||
| (((x) & 0x00ff000000000000ul) >> 40) \
|
||||
| (((x) & 0x0000ff0000000000ul) >> 24) \
|
||||
| (((x) & 0x000000ff00000000ul) >> 8) \
|
||||
| (((x) & 0x00000000ff000000ul) << 8) \
|
||||
| (((x) & 0x0000000000ff0000ul) << 24) \
|
||||
| (((x) & 0x000000000000ff00ul) << 40) \
|
||||
| (((x) & 0x00000000000000fful) << 56))
|
||||
((((x) & 0xff00000000000000ull) >> 56) \
|
||||
| (((x) & 0x00ff000000000000ull) >> 40) \
|
||||
| (((x) & 0x0000ff0000000000ull) >> 24) \
|
||||
| (((x) & 0x000000ff00000000ull) >> 8) \
|
||||
| (((x) & 0x00000000ff000000ull) << 8) \
|
||||
| (((x) & 0x0000000000ff0000ull) << 24) \
|
||||
| (((x) & 0x000000000000ff00ull) << 40) \
|
||||
| (((x) & 0x00000000000000ffull) << 56))
|
||||
|
||||
static __inline unsigned long long int
|
||||
__bswap_64 (unsigned long long int __bsx)
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Macros to swap the order of bytes in integer values.
|
||||
Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007, 2008, 2010, 2011
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -131,6 +130,22 @@
|
||||
} \
|
||||
__r.__ll; }))
|
||||
# endif
|
||||
#elif __GLIBC_HAVE_LONG_LONG
|
||||
# define __bswap_constant_64(x) \
|
||||
((((x) & 0xff00000000000000ull) >> 56) \
|
||||
| (((x) & 0x00ff000000000000ull) >> 40) \
|
||||
| (((x) & 0x0000ff0000000000ull) >> 24) \
|
||||
| (((x) & 0x000000ff00000000ull) >> 8) \
|
||||
| (((x) & 0x00000000ff000000ull) << 8) \
|
||||
| (((x) & 0x0000000000ff0000ull) << 24) \
|
||||
| (((x) & 0x000000000000ff00ull) << 40) \
|
||||
| (((x) & 0x00000000000000ffull) << 56))
|
||||
|
||||
static __inline unsigned long long int
|
||||
__bswap_64 (unsigned long long int __bsx)
|
||||
{
|
||||
return __bswap_constant_64 (__bsx);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BITS_BYTESWAP_H */
|
||||
|
Loading…
Reference in New Issue
Block a user