bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memchr speed


From: Eric Blake
Subject: Re: memchr speed
Date: Mon, 28 Apr 2008 16:25:36 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Simon Josefsson <simon <at> josefsson.org> writes:

> > 2008-04-26  Eric Blake  <ebb9 <at> byu.net>
> >             Bruno Haible  <bruno <at> clisp.org>
> >
> >     * lib/memchr.c: Include intprops.h.
> 
> This causes a license incompatibility for GnuTLS:
> 
> This causes license incompatibility because intprops is LGPL:
> gnulib-tool: *** incompatible license on module intprops: LGPL
> gnulib-tool: *** Stop.
> 
> GnuTLS uses memmem-simple which pulls in memchr.

I think it would be even simpler to just avoid intprops.h (after all, memchr.c 
was originally borrowed from glibc, which doesn't have intprops.h).  Perhaps 
something along the lines of this fix would be better, if we plan on pushing 
memchr, strchrnul, and memrchr improvements back to glibc?

>From fd7d4c32b4554c297e0fc73e8841fee11283444f Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 28 Apr 2008 10:24:14 -0600
Subject: [PATCH] Remove intprops dependency.

* modules/memchr (Depends-on): Remove intprops.
* lib/memchr.c (__memchr): Hand-inline the TYPE_MAXIMUM check.
Reported by Simon Josefsson.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog      |    9 ++++++++-
 lib/memchr.c   |    4 +---
 modules/memchr |    1 -
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 53fe2a8..6acad53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-04-28  Eric Blake  <address@hidden>
+
+       Remove intprops dependency.
+       * modules/memchr (Depends-on): Remove intprops.
+       * lib/memchr.c (__memchr): Hand-inline the TYPE_MAXIMUM check.
+       Reported by Simon Josefsson.
+
 2008-04-28  Simon Josefsson  <address@hidden>
 
        * lib/inet_ntop.h, lib/inet_pton.h: Remove files.
@@ -162,7 +169,7 @@
        * tests/test-memchr.c; New file, based on tests/test-memchr2.c.
 
 2008-04-26  Eric Blake  <address@hidden>
-            Bruno Haible  <address@hidden>
+           Bruno Haible  <address@hidden>
 
        * lib/memchr.c: Include intprops.h.
        (__memchr): Optimize parallel detection of matching bytes. Rename local
diff --git a/lib/memchr.c b/lib/memchr.c
index 2398dc3..ab98aea 100644
--- a/lib/memchr.c
+++ b/lib/memchr.c
@@ -45,8 +45,6 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.  */
 # define BP_SYM(sym) sym
 #endif
 
-#include "intprops.h"
-
 #undef __memchr
 #ifdef _LIBC
 # undef memchr
@@ -94,7 +92,7 @@ __memchr (void const *s, int c_in, size_t n)
   repeated_one = 0x01010101;
   repeated_c = c | (c << 8);
   repeated_c |= repeated_c << 16;
-  if (0xffffffffU < TYPE_MAXIMUM (longword))
+  if (0xffffffffU < (longword) -1)
     {
       repeated_one |= repeated_one << 31 << 1;
       repeated_c |= repeated_c << 31 << 1;
diff --git a/modules/memchr b/modules/memchr
index 718a3fc..5e908d2 100644
--- a/modules/memchr
+++ b/modules/memchr
@@ -6,7 +6,6 @@ lib/memchr.c
 m4/memchr.m4
 
 Depends-on:
-intprops
 
 configure.ac:
 gl_FUNC_MEMCHR
-- 
1.5.5.1








reply via email to

[Prev in Thread] Current Thread [Next in Thread]