summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/i386/memchr.S
blob: 7d04f990bfd39be405b94bf1b22cba22b7b28368 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.text
.align 0
.global memchr
.type	 memchr,@function
memchr:
	pushl %edi
	movl 8(%esp),%edi
	movl 12(%esp),%eax
	movl 16(%esp),%ecx
	cld
	jecxz .Lnotfound

	repne scasb

	je .Lfound
.Lnotfound:
	xorl %edi, %edi
	incl %edi
.Lfound:
	movl %edi, %eax
	decl %eax

	popl %edi
	ret