From 482eec0d1188823ad93247f79bf965886e8bd4f7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 16 Jan 1999 17:09:04 +0000 Subject: Update. 1999-01-16 Ulrich Drepper * elf/Makefile (tests): Add loadtest. Add rules to generate test modules. * Makeconfig (+link): Add $(LDFLAGS-$(@F)) to command line. * elf/loadtest.c: New file. * elf/testobj1.c: New file. * elf/testobj2.c: New file. * elf/testobj3.c: New file. * elf/dl-close.c: Correct removing module from global list. * elf/dl-open.c: Add debugging code. * include/string.h: Add __rawmemchr prototype. * string/Makefile (routines): Add rawmemchr. * string/Versions [GLIBC_2.1]: Add __rawmemchr and rawmemchr. * string/string.h: Add prototype for rawmemchr. * string/bits/string2.h: Optimize strchr with rawmemchr. * sysdeps/generic/rawmemchr.c: New file. * sysdeps/i386/rawmemchr.c: New file. * sysdeps/i386/i486/bits/string.h: Add rawmemchr inline code. Optimize strchr with rawmemchr. * sysdeps/unix/sysv/linux/bits/posix_opt.h: Define _LFS_LARGEFILE, _LFS64_LARGEFILE, and _LFS64_STDIO for Unix98. 1999-01-14 Andreas Jaeger * nis/nis_error.c (nis_errlist): Fix capitilasation. --- sysdeps/i386/i486/bits/string.h | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'sysdeps/i386/i486/bits') diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h index f810de06ea..e20f037ab7 100644 --- a/sysdeps/i386/i486/bits/string.h +++ b/sysdeps/i386/i486/bits/string.h @@ -1,5 +1,5 @@ /* Optimized, inlined string functions. i486 version. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -377,6 +377,30 @@ memchr (__const void *__s, int __c, size_t __n) } +/* Return pointer to C in S. */ +#define _HAVE_STRING_ARCH_rawmemchr 1 +__STRING_INLINE void * +__rawmemchr (const void *__s, int __c) +{ + register unsigned long int __d0; + register unsigned char *__res; + __asm__ __volatile__ + ("cld\n\t" + "repne; scasb\n\t" + : "=D" (__res), "=&c" (__d0) + : "a" (__c), "0" (__s), "1" (0xffffffff) + : "cc"); + return __res - 1; +} +#ifdef __USE_GNU +__STRING_INLINE void * +rawmemchr (const void *__s, int __c) +{ + return __rawmemchr (__s, __c); +} +#endif /* use GNU */ + + /* Return the length of S. */ #define _HAVE_STRING_ARCH_strlen 1 #define strlen(str) \ @@ -1049,7 +1073,9 @@ __strncmp_g (__const char *__s1, __const char *__s2, size_t __n) #define _HAVE_STRING_ARCH_strchr 1 #define strchr(s, c) \ (__extension__ (__builtin_constant_p (c) \ - ? __strchr_c (s, ((c) & 0xff) << 8) \ + ? ((c) == '\0' \ + ? (char *) __rawmemchr (s, c) \ + : __strchr_c (s, ((c) & 0xff) << 8)) \ : __strchr_g (s, c))) __STRING_INLINE char *__strchr_c (__const char *__s, int __c); -- cgit 1.4.1