[PATCH v12 08/31] string: Improve generic strncmp

Richard Henderson richard.henderson@linaro.org
Fri Feb 3 00:34:22 GMT 2023


On 2/2/23 08:11, Adhemerval Zanella wrote:
> It follows the strategy:
> 
>     - Align the first input to word boundary using byte operations.
> 
>     - If second input is also word aligned, read a word per time, check
>       for  null (using has_zero), and check final words using byte
>       operation.
> 
>     - If second input is not word aligned, loop by aligning the source,
>       and merge the result of two reads.  Similar to aligned case, check
>       for null with has_zero, and check final words using byte operation.
> 
> 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/strncmp.c | 138 ++++++++++++++++++++++++++++++++++-------------
>   1 file changed, 101 insertions(+), 37 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


More information about the Libc-alpha mailing list