This is the mail archive of the glibc-cvs@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]

GNU C Library master sources branch, hjl/bswap, updated. glibc-2.15-565-g80b632b


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/bswap has been updated
       via  80b632b61177ca19c690a6f3a7e06e6e35922b6d (commit)
      from  f8887d0a5feda97244613135822b0439addc2b1f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=80b632b61177ca19c690a6f3a7e06e6e35922b6d

commit 80b632b61177ca19c690a6f3a7e06e6e35922b6d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Apr 6 15:39:43 2012 -0700

    Use __builtin_bswap32/64 in __bswap_32/64 for GCC >= 4.2

diff --git a/ChangeLog b/ChangeLog
index 91e8361..b9e6739 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2012-04-06  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* bits/byteswap.h (__bswap_32): Use __builtin_bswap32 for
+	GCC >= 4.2.
+	(__bswap_64): Use __builtin_bswap64 for GCC >= 4.2.
+
+2012-04-06  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* bits/byteswap.h (__bswap_16): Removed.
 	Include <bits/byteswap-16.h> to get __bswap_16.
 	* sysdeps/i386/bits/byteswap.h: Likewise.
diff --git a/bits/byteswap.h b/bits/byteswap.h
index 6e3ed3f..2ac2d5e 100644
--- a/bits/byteswap.h
+++ b/bits/byteswap.h
@@ -35,19 +35,17 @@
      ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >>  8) |	      \
       (((x) & 0x0000ff00u) <<  8) | (((x) & 0x000000ffu) << 24))
 
-#ifdef __GNUC__
-# define __bswap_32(x) \
-  (__extension__							      \
-   ({ register unsigned int __bsx = (x); __bswap_constant_32 (__bsx); }))
-#else
 static __inline unsigned int
 __bswap_32 (unsigned int __bsx)
 {
+#if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
+  return __builtin_bswap32 (__bsx);
+#else
   return __bswap_constant_32 (__bsx);
-}
 #endif
+}
 
-#if defined __GNUC__ && __GNUC__ >= 2
+#if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
 /* Swap bytes in 64 bit value.  */
 # define __bswap_constant_64(x) \
      (__extension__ ((((x) & 0xff00000000000000ull) >> 56)		      \
@@ -59,19 +57,11 @@ __bswap_32 (unsigned int __bsx)
 		     | (((x) & 0x000000000000ff00ull) << 40)		      \
 		     | (((x) & 0x00000000000000ffull) << 56)))
 
-# define __bswap_64(x) \
-     (__extension__							      \
-      ({ union { __extension__ unsigned long long int __ll;		      \
-		 unsigned int __l[2]; } __w, __r;			      \
-	 if (__builtin_constant_p (x))					      \
-	   __r.__ll = __bswap_constant_64 (x);				      \
-	 else								      \
-	   {								      \
-	     __w.__ll = (x);						      \
-	     __r.__l[0] = __bswap_32 (__w.__l[1]);			      \
-	     __r.__l[1] = __bswap_32 (__w.__l[0]);			      \
-	   }								      \
-	 __r.__ll; }))
+static __inline unsigned long long int
+__bswap_64 (unsigned long long int __bsx)
+{
+  return __builtin_bswap64 (__bsx);
+}
 #elif __GLIBC_HAVE_LONG_LONG
 # define __bswap_constant_64(x) \
      ((((x) & 0xff00000000000000ull) >> 56)				      \

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog       |    6 ++++++
 bits/byteswap.h |   30 ++++++++++--------------------
 2 files changed, 16 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]