about summary refs log tree commit diff
path: root/sysdeps/s390/strlen-c.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-01-10 18:00:54 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-02-06 16:19:35 -0300
commit350d8d13661a863e6b189f02d876fa265fe71302 (patch)
treee0db50d920d3edecd1becd9b65c7be91810609d0 /sysdeps/s390/strlen-c.c
parent00cb84dde75f44847aab094aa3779cc5d222c7e4 (diff)
downloadglibc-350d8d13661a863e6b189f02d876fa265fe71302.tar.gz
glibc-350d8d13661a863e6b189f02d876fa265fe71302.tar.xz
glibc-350d8d13661a863e6b189f02d876fa265fe71302.zip
string: Improve generic strlen
New algorithm read the first aligned address and mask off the
unwanted bytes (this strategy is similar to arch-specific
implementations used on powerpc, sparc, and sh).

The loop now read word-aligned address and check using the has_zero
macro.

Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc-linux-gnu,
and powercp64-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).

Co-authored-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Diffstat (limited to 'sysdeps/s390/strlen-c.c')
-rw-r--r--sysdeps/s390/strlen-c.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sysdeps/s390/strlen-c.c b/sysdeps/s390/strlen-c.c
index b829ef2452..0a33a6f8e5 100644
--- a/sysdeps/s390/strlen-c.c
+++ b/sysdeps/s390/strlen-c.c
@@ -21,12 +21,14 @@
 #if HAVE_STRLEN_C
 # if HAVE_STRLEN_IFUNC
 #  define STRLEN STRLEN_C
+# endif
+
+# include <string/strlen.c>
+
+# if HAVE_STRLEN_IFUNC
 #  if defined SHARED && IS_IN (libc)
-#   undef libc_hidden_builtin_def
-#   define libc_hidden_builtin_def(name)		\
-  __hidden_ver1 (__strlen_c, __GI_strlen, __strlen_c);
+__hidden_ver1 (__strlen_c, __GI_strlen, __strlen_c);
 #  endif
 # endif
 
-# include <string/strlen.c>
 #endif