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 master updated. glibc-2.22-88-g5542236


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, master has been updated
       via  5542236837c5c41435f8282ec92799f480c36f18 (commit)
      from  1814df5b02b9c359052c2048a1d2d617b406a17a (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://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5542236837c5c41435f8282ec92799f480c36f18

commit 5542236837c5c41435f8282ec92799f480c36f18
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Tue Jul 21 22:50:29 2015 -0700

    Port the 0x7efe...feff pattern to GCC 6.
    
    See Steve Ellcey's bug report in:
    https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
    * string/memrchr.c (MEMRCHR):
    * string/rawmemchr.c (RAWMEMCHR):
    * string/strchr.c (strchr):
    * string/strchrnul.c (STRCHRNUL):
    Rewrite code to avoid issues with signed shift overflow.

diff --git a/ChangeLog b/ChangeLog
index db5d483..bfc31fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2015-08-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+	Port the 0x7efe...feff pattern to GCC 6.
+	See Steve Ellcey's bug report in:
+	https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
+	* string/memrchr.c (MEMRCHR):
+	* string/rawmemchr.c (RAWMEMCHR):
+	* string/strchr.c (strchr):
+	* string/strchrnul.c (STRCHRNUL):
+	Rewrite code to avoid issues with signed shift overflow.
+
 2015-08-18  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/x86/cpu-features.c (init_cpu_features): Check
diff --git a/string/memrchr.c b/string/memrchr.c
index 0c8fd84..86cd5b9 100644
--- a/string/memrchr.c
+++ b/string/memrchr.c
@@ -96,15 +96,8 @@ MEMRCHR
 
      The 1-bits make sure that carries propagate to the next 0-bit.
      The 0-bits provide holes for carries to fall into.  */
-
-  if (sizeof (longword) != 4 && sizeof (longword) != 8)
-    abort ();
-
-#if LONG_MAX <= LONG_MAX_32_BITS
-  magic_bits = 0x7efefeff;
-#else
-  magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
-#endif
+  magic_bits = -1;
+  magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
 
   /* Set up a longword, each of whose bytes is C.  */
   charmask = c | (c << 8);
diff --git a/string/rawmemchr.c b/string/rawmemchr.c
index 05b22be..228ca9d 100644
--- a/string/rawmemchr.c
+++ b/string/rawmemchr.c
@@ -86,15 +86,8 @@ RAWMEMCHR (s, c_in)
 
      The 1-bits make sure that carries propagate to the next 0-bit.
      The 0-bits provide holes for carries to fall into.  */
-
-  if (sizeof (longword) != 4 && sizeof (longword) != 8)
-    abort ();
-
-#if LONG_MAX <= LONG_MAX_32_BITS
-  magic_bits = 0x7efefeff;
-#else
-  magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
-#endif
+  magic_bits = -1;
+  magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
 
   /* Set up a longword, each of whose bytes is C.  */
   charmask = c | (c << 8);
diff --git a/string/strchr.c b/string/strchr.c
index 5f90075..f13b2b3 100644
--- a/string/strchr.c
+++ b/string/strchr.c
@@ -60,13 +60,8 @@ strchr (const char *s, int c_in)
 
      The 1-bits make sure that carries propagate to the next 0-bit.
      The 0-bits provide holes for carries to fall into.  */
-  switch (sizeof (longword))
-    {
-    case 4: magic_bits = 0x7efefeffL; break;
-    case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
-    default:
-      abort ();
-    }
+  magic_bits = -1;
+  magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
 
   /* Set up a longword, each of whose bytes is C.  */
   charmask = c | (c << 8);
diff --git a/string/strchrnul.c b/string/strchrnul.c
index 2678f1d..daf0b3f 100644
--- a/string/strchrnul.c
+++ b/string/strchrnul.c
@@ -66,13 +66,8 @@ STRCHRNUL (s, c_in)
 
      The 1-bits make sure that carries propagate to the next 0-bit.
      The 0-bits provide holes for carries to fall into.  */
-  switch (sizeof (longword))
-    {
-    case 4: magic_bits = 0x7efefeffL; break;
-    case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
-    default:
-      abort ();
-    }
+  magic_bits = -1;
+  magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
 
   /* Set up a longword, each of whose bytes is C.  */
   charmask = c | (c << 8);

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

Summary of changes:
 ChangeLog          |   11 +++++++++++
 string/memrchr.c   |   11 ++---------
 string/rawmemchr.c |   11 ++---------
 string/strchr.c    |    9 ++-------
 string/strchrnul.c |    9 ++-------
 5 files changed, 19 insertions(+), 32 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]