blob: 097b4f1f6998e53e26366816197995923cbc18fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
* Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com>
*/
#include <machine/asm.h>
ENTRY(strrchr)
movb %sil,%cl
xorq %rax,%rax /* init pointer to null */
L1:
movb (%rdi),%dl
cmpb %dl,%cl
jne L2
movq %rdi,%rax
L2:
incq %rdi
testb %dl,%dl /* null terminator??? */
jnz L1
ret
|