* libc/machine/aarch64/memchr.S: Add check for zero-sized buffer.

This commit is contained in:
Richard Earnshaw 2014-08-19 10:44:44 +00:00
parent de1c312566
commit 59c3d5a1a4
2 changed files with 10 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2014-08-19 Richard Earnshaw <rearnsha@arm.com>
* libc/machine/aarch64/memchr.S: Add check for zero-sized buffer.
2014-08-18 Corinna Vinschen <vinschen@redhat.com>
* libc/include/sys/signal.h: Declare sigaltstack for RTEMS only.

View File

@ -79,6 +79,8 @@
.endm
def_fn memchr
/* Do not dereference srcin if no bytes to compare. */
cbz cntin, .Lzero_length
/*
* Magic constant 0x40100401 allows us to identify which lane matches
* the requested byte.
@ -166,5 +168,9 @@ def_fn memchr
csel result, xzr, result, eq
ret
.Lzero_length:
mov result, #0
ret
.size memchr, . - memchr
#endif