mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 17:53:37 +08:00
wcsmbs: Use loop_unroll on wcschr
This allows an architecture to set explicit loop unrolling. Checked on aarch64-linux-gnu. * wcsmbs/wcschr.c (WCSCHR): Use loop_unroll.h to parametrize the loop unroll.
This commit is contained in:
parent
447a1306c3
commit
7ba0100c6a
@ -1,5 +1,8 @@
|
|||||||
2019-04-04 Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
2019-04-04 Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||||
|
|
||||||
|
* wcsmbs/wcschr.c (WCSCHR): Use loop_unroll.h to parametrize
|
||||||
|
the loop unroll.
|
||||||
|
|
||||||
* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcscpy.c):
|
* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcscpy.c):
|
||||||
New rule.
|
New rule.
|
||||||
* sysdeps/powerpc/power6/wcscpy.c: Remove file.
|
* sysdeps/powerpc/power6/wcscpy.c: Remove file.
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
#include <loop_unroll.h>
|
||||||
|
|
||||||
#ifndef WCSCHR
|
#ifndef WCSCHR
|
||||||
# define WCSCHR __wcschr
|
# define WCSCHR __wcschr
|
||||||
@ -25,12 +26,23 @@
|
|||||||
wchar_t *
|
wchar_t *
|
||||||
WCSCHR (const wchar_t *wcs, const wchar_t wc)
|
WCSCHR (const wchar_t *wcs, const wchar_t wc)
|
||||||
{
|
{
|
||||||
do
|
wchar_t *dest = NULL;
|
||||||
if (*wcs == wc)
|
|
||||||
return (wchar_t *) wcs;
|
|
||||||
while (*wcs++ != L'\0');
|
|
||||||
|
|
||||||
return NULL;
|
#define ITERATION(index) \
|
||||||
|
({ \
|
||||||
|
if (*wcs == wc) \
|
||||||
|
dest = (wchar_t*) wcs; \
|
||||||
|
dest == NULL && *wcs++ != L'\0'; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#ifndef UNROLL_NTIMES
|
||||||
|
# define UNROLL_NTIMES 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
UNROLL_REPEAT (UNROLL_NTIMES, ITERATION);
|
||||||
|
|
||||||
|
return dest;
|
||||||
}
|
}
|
||||||
libc_hidden_def (__wcschr)
|
libc_hidden_def (__wcschr)
|
||||||
weak_alias (__wcschr, wcschr)
|
weak_alias (__wcschr, wcschr)
|
||||||
|
Loading…
Reference in New Issue
Block a user