Welcome to mirror list, hosted at ThFree Co, Russian Federation.

memchr.S « i386 « machine « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d29a0452142ab7ed7763f7f328d9e88b7a8ce9d6 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * ====================================================
 * Copyright (C) 1998, 2002 by Red Hat Inc. All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * is preserved.
 * ====================================================
 */

	#include "i386mach.h"
	
	.global	SYM (memchr)
       SOTYPE_FUNCTION(memchr)

SYM (memchr):
	pushl	ebp
	movl	esp,ebp
	pushl 	edi
	movl 	12(ebp),eax
	movl 	16(ebp),ecx
	movl 	8(ebp),edi

	xorl	edx,edx
	testl	ecx,ecx
	jz	L1

	cld
	repnz
	scasb

	setnz	dl
	decl	edi
	decl	edx
	andl	edi,edx
L1:
	movl	edx,eax

	leal	-4(ebp),esp
	popl	edi
	leave
	ret