]> git.ipfire.org Git - thirdparty/glibc.git/commit
x86: Remove unnecessary overflow check from wcsnlen-sse4_1.S
authorNoah Goldstein <goldstein.w.n@gmail.com>
Wed, 23 Jun 2021 23:19:34 +0000 (19:19 -0400)
committerNoah Goldstein <goldstein.w.n@gmail.com>
Thu, 24 Jun 2021 23:14:19 +0000 (19:14 -0400)
commit08cbcd4dbc686bb38ec3093aff2f919fbff5ec17
tree970437dd91d18f00c146e93265d2b0aeae8f9c1d
parentbd3a2b3ed18fdeff0b370110c35850b51d025e8c
x86: Remove unnecessary overflow check from wcsnlen-sse4_1.S

No bug. The way wcsnlen will check if near the end of maxlen
is the following macro:

mov %r11, %rsi; \
subq %rax, %rsi; \
andq $-64, %rax; \
testq $-64, %rsi; \
je L(strnlen_ret)

Which words independently of s + maxlen overflowing. So the
second overflow check is unnecissary for correctness and
just extra overhead in the common no overflow case.

test-strlen.c, test-wcslen.c, test-strnlen.c and test-wcsnlen.c are
all passing

Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
sysdeps/x86_64/multiarch/strlen-vec.S