This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Thu, Apr 5, 2012 at 11:50 PM, Andreas Jaeger<aj@suse.com> wrote:On 04/05/2012 10:08 PM, H.J. Lu wrote:
Hi,
sysdeps/x86_64/bits/byteswap.h has
#if defined __GNUC__&& __GNUC__>= 2
.. #else # define __bswap_32(x) \ (__extension__ \ ({ register unsigned int __x = (x); __bswap_constant_32 (__x); })) #endif
It doesn't work for compilers without GCC __extension__ support.
This patch uses __builtin_bswap32/64 for GCC>= 4.2. I used inline function instead of __extension__ to avoid the __builtin_bswap32/64 return type issue:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37743
Tested on Linux/ia32 and Linux/x86-64. OK to install?
Thanks.
H.J. -- 2012-04-05 H.J. Lu<hongjiu.lu@intel.com>
* sysdeps/i386/bits/byteswap.h: (__bswap_32): Use __builtin_bswap32 for GCC>= 4.2. (__bswap_64): Use __builtin_bswap64 for GCC>= 4.2. * sysdeps/x86_64/bits/byteswap.h: Likewise.
Please check all other byteswap.h functions as well and do a similar change there as well.
Btw. I see a lot of duplication in this code. Perhaps we can reduce the number of files somehow.
That is a good idea. This patch adds bits/byteswap2.h for __bswap_16 and put common 32bit and 64bit bswap in bits/byteswap.h. I created hjl/bswap branch with my change. OK to install?
Andreas -- Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |