1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Add optimized wcslen and strnlen for x86-32

This commit is contained in:
Liubov Dmitrieva
2011-10-23 15:17:23 -04:00
committed by Ulrich Drepper
parent 09229f3e1b
commit fc2ee42abe
12 changed files with 783 additions and 73 deletions

View File

@ -1,5 +1,5 @@
/* Find the length of STRING, but scan at most MAXLEN characters.
Copyright (C) 1991,1993,1997,2000,2001,2005 Free Software Foundation, Inc.
Copyright (C) 1991, 1993, 1997, 2000, 2001, 2005, 2011 Free Software Foundation, Inc.
Contributed by Jakub Jelinek <jakub@redhat.com>.
Based on strlen written by Torbjorn Granlund (tege@sics.se),
@ -26,8 +26,13 @@
/* Find the length of S, but scan at most MAXLEN characters. If no
'\0' terminator is found in that many characters, return MAXLEN. */
#ifndef STRNLEN
# define STRNLEN __strnlen
#endif
size_t
__strnlen (const char *str, size_t maxlen)
STRNLEN (const char *str, size_t maxlen)
{
const char *char_ptr, *end_ptr = str + maxlen;
const unsigned long int *longword_ptr;
@ -157,5 +162,7 @@ __strnlen (const char *str, size_t maxlen)
char_ptr = end_ptr;
return char_ptr - str;
}
#ifndef STRNLEN
weak_alias (__strnlen, strnlen)
#endif
libc_hidden_def (strnlen)