string: Improve generic strrchr with memrchr and strlen
commit167f6230af97690985ccbc9b3026a7c32ec2d6e9
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 2 Feb 2023 16:44:13 +0000 (2 13:44 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 6 Feb 2023 19:19:35 +0000 (6 16:19 -0300)
tree0b3bc532d9b3f61d4cddb3fe5b2797261f83dae2
parent9d4fa7a1ca9154e814b7ede8d48186832bdbebe6
string: Improve generic strrchr with memrchr and strlen

Now that both strlen and memrchr have word vectorized implementation,
it should be faster to implement strrchr based on memrchr over the
string length instead of calling strchr on a loop.

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