diff options
author | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2014-03-20 11:24:52 -0500 |
---|---|---|
committer | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2014-03-20 11:24:52 -0500 |
commit | 6eaf95cbfa0031ea267682dc2c9c17ed3e3dc167 (patch) | |
tree | 93cf4f0efb9ce1654e9f298b6342953a7935965a /string | |
parent | ae3a5dff0f4135cc57ddddf3c19ed5be80285b54 (diff) | |
download | glibc-6eaf95cbfa0031ea267682dc2c9c17ed3e3dc167.zip glibc-6eaf95cbfa0031ea267682dc2c9c17ed3e3dc167.tar.gz glibc-6eaf95cbfa0031ea267682dc2c9c17ed3e3dc167.tar.bz2 |
PowerPC: optimized strcspn for PPC64/POWER7
This patch add a optimized strcspn for POWER7 by using a different
algorithm than default implementation: it constructs a table based on
the 'accept' argument and use this table to check for any occurance
on the input string. The idea is similar as x86_64 uses.
For PowerPC some tunings were added, such as unroll loops and align
stack memory to table to 16 bytes (so VSX clean can ran without
alignment issues).
Diffstat (limited to 'string')
-rw-r--r-- | string/strcspn.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/string/strcspn.c b/string/strcspn.c index 7c39f79..4316205 100644 --- a/string/strcspn.c +++ b/string/strcspn.c @@ -15,27 +15,18 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#if defined _LIBC || HAVE_STRING_H -# include <string.h> -#else -# include <strings.h> -# ifndef strchr -# define strchr index -# endif -#endif +#include <string.h> #undef strcspn +#ifndef STRCSPN +# define STRCSPN strcspn +#endif + /* Return the length of the maximum initial segment of S which contains no characters from REJECT. */ size_t -strcspn (s, reject) - const char *s; - const char *reject; +STRCSPN (const char *s, const char *reject) { size_t count = 0; |