[PATCH v11 10/29] string: Improve generic stpcpy
Richard Henderson
richard.henderson@linaro.org
Wed Feb 1 17:37:47 GMT 2023
On 2/1/23 07:03, Adhemerval Zanella wrote:
> It follows the strategy:
>
> - Align the destination on word boundary using byte operations.
>
> - If source is also word aligned, read a word per time, check for
> null (using has_zero from string-fzb.h), and write the remaining
> bytes.
>
> - If source is not word aligned, loop by aligning the source, and
> merging the result of two reads. Similar to aligned case,
> check for null with has_zero, and write the remaining bytes if
> null is found.
>
> Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64-linux-gnu,
> and powerpc-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/stpcpy.c | 92 +++++++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 86 insertions(+), 6 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
More information about the Libc-alpha
mailing list