diff options
author | Andreas Jaeger <aj@suse.de> | 2012-03-28 16:39:25 +0200 |
---|---|---|
committer | Andreas Jaeger <aj@suse.de> | 2012-04-03 09:13:59 +0200 |
commit | b1aa60f32d34030b28bca04aeee084cd3bedecfa (patch) | |
tree | 430b4c30f7a613b4b219528ec861de1b2c5b1172 /sysdeps | |
parent | 39c59c35723120c32dc42dde4115bba92305179f (diff) | |
download | glibc-b1aa60f32d34030b28bca04aeee084cd3bedecfa.zip glibc-b1aa60f32d34030b28bca04aeee084cd3bedecfa.tar.gz glibc-b1aa60f32d34030b28bca04aeee084cd3bedecfa.tar.bz2 |
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.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/i386/bits/byteswap.h | 19 | ||||
-rw-r--r-- | sysdeps/s390/bits/byteswap.h | 20 | ||||
-rw-r--r-- | sysdeps/x86_64/bits/byteswap.h | 19 |
3 files changed, 44 insertions, 14 deletions
diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h index 4a159d1..fb0a827 100644 --- a/sysdeps/i386/bits/byteswap.h +++ b/sysdeps/i386/bits/byteswap.h @@ -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 */ diff --git a/sysdeps/s390/bits/byteswap.h b/sysdeps/s390/bits/byteswap.h index ac325b0..fd7c279 100644 --- a/sysdeps/s390/bits/byteswap.h +++ b/sysdeps/s390/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) diff --git a/sysdeps/x86_64/bits/byteswap.h b/sysdeps/x86_64/bits/byteswap.h index 5094a05..472281f 100644 --- a/sysdeps/x86_64/bits/byteswap.h +++ b/sysdeps/x86_64/bits/byteswap.h @@ -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 */ |