From 8b8527c54ce6fc1331805d44bd2c556b58976844 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 28 Apr 2008 10:24:14 -0600 Subject: [PATCH 1/1] Remove intprops dependency. * modules/memchr (Depends-on): Remove intprops. * modules/memrchr (Depends-on): Likewise. * modules/memchr2 (Depends-on): Likewise. * lib/memchr.c (__memchr): Hand-inline the TYPE_MAXIMUM check. * lib/memrchr.c (__memrchr): Likewise. * lib/memrchr2.c (memchr2): Likewise. Reported by Simon Josefsson. Signed-off-by: Eric Blake --- ChangeLog | 13 ++++++++++++- lib/memchr.c | 6 ++---- lib/memchr2.c | 6 ++---- lib/memrchr.c | 6 ++---- modules/memchr | 1 - modules/memchr2 | 1 - modules/memrchr | 1 - 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36e8ab5a7..74522bf35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-04-28 Eric Blake + + Remove intprops dependency. + * modules/memchr (Depends-on): Remove intprops. + * modules/memrchr (Depends-on): Likewise. + * modules/memchr2 (Depends-on): Likewise. + * lib/memchr.c (__memchr): Hand-inline the TYPE_MAXIMUM check. + * lib/memrchr.c (__memrchr): Likewise. + * lib/memrchr2.c (memchr2): Likewise. + Reported by Simon Josefsson. + 2008-04-28 Simon Josefsson * m4/sys_socket_h.m4: Move AC_REQUIRE([AC_C_INLINE]) to top. @@ -167,7 +178,7 @@ * tests/test-memchr.c; New file, based on tests/test-memchr2.c. 2008-04-26 Eric Blake - Bruno Haible + Bruno Haible * 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 2398dc3df..2253d2d65 100644 --- a/lib/memchr.c +++ b/lib/memchr.c @@ -45,8 +45,6 @@ along with this program. If not, see . */ # define BP_SYM(sym) sym #endif -#include "intprops.h" - #undef __memchr #ifdef _LIBC # undef memchr @@ -65,7 +63,7 @@ __memchr (void const *s, int c_in, size_t n) performance. On 64-bit hardware, unsigned long is generally 64 bits already. Change this typedef to experiment with performance. */ - typedef unsigned long longword; + typedef unsigned long int longword; const unsigned char *char_ptr; const longword *longword_ptr; @@ -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/lib/memchr2.c b/lib/memchr2.c index 850d3804e..ad78195ee 100644 --- a/lib/memchr2.c +++ b/lib/memchr2.c @@ -29,8 +29,6 @@ along with this program. If not, see . */ #include #include -#include "intprops.h" - /* Return the first address of either C1 or C2 (treated as unsigned char) that occurs within N bytes of the memory region S. If neither byte appears, return NULL. */ @@ -42,7 +40,7 @@ memchr2 (void const *s, int c1_in, int c2_in, size_t n) performance. On 64-bit hardware, unsigned long is generally 64 bits already. Change this typedef to experiment with performance. */ - typedef unsigned long longword; + typedef unsigned long int longword; const unsigned char *char_ptr; const longword *longword_ptr; @@ -80,7 +78,7 @@ memchr2 (void const *s, int c1_in, int c2_in, size_t n) repeated_c2 = c2 | (c2 << 8); repeated_c1 |= repeated_c1 << 16; repeated_c2 |= repeated_c2 << 16; - if (0xffffffffU < TYPE_MAXIMUM (longword)) + if (0xffffffffU < (longword) -1) { repeated_one |= repeated_one << 31 << 1; repeated_c1 |= repeated_c1 << 31 << 1; diff --git a/lib/memrchr.c b/lib/memrchr.c index 2796dea3f..da93ca0ba 100644 --- a/lib/memrchr.c +++ b/lib/memrchr.c @@ -32,8 +32,6 @@ #include #include -#include "intprops.h" - #undef __memrchr #ifdef _LIBC # undef memrchr @@ -52,7 +50,7 @@ __memrchr (void const *s, int c_in, size_t n) performance. On 64-bit hardware, unsigned long is generally 64 bits already. Change this typedef to experiment with performance. */ - typedef unsigned long longword; + typedef unsigned long int longword; const unsigned char *char_ptr; const longword *longword_ptr; @@ -81,7 +79,7 @@ __memrchr (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 718a3fc0f..5e908d2bf 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 diff --git a/modules/memchr2 b/modules/memchr2 index da5671de1..7e834157a 100644 --- a/modules/memchr2 +++ b/modules/memchr2 @@ -6,7 +6,6 @@ lib/memchr2.h lib/memchr2.c Depends-on: -intprops stdint memchr diff --git a/modules/memrchr b/modules/memrchr index 36a119db6..3a6e982b6 100644 --- a/modules/memrchr +++ b/modules/memrchr @@ -7,7 +7,6 @@ m4/memrchr.m4 Depends-on: extensions -intprops string configure.ac: -- 2.11.0