shithub: scc

ref: 919c865b5f8c58a9207b097c467fb94158f3a9b3
dir: /src/libc/arch/amd64/memchr.s/

View raw version
	.file 	"memchr.s"

	.text
	.globl	memchr,_memchr
_memchr:
memchr:
	cmpq	$0,%rdx
	je	notfound

	movq	%rdx,%rcx
	movb	%sil,%al
	cld
	repne
	scasb
	je 	found

notfound:
	xor	%eax,%eax
	ret

found:
	leaq	-1(%rdi),%rax
	ret