xref: /reactos/sdk/lib/crt/mem/i386/memchr_asm.s (revision 5100859e)
1/*
2 * COPYRIGHT:       See COPYING in the top level directory
3 * PROJECT:         ReactOS kernel
4 * FILE:            lib/sdk/crt/mem/i386/memchr_asm.s
5 */
6
7#include <asm.inc>
8#include <ks386.inc>
9
10/*
11 * void* memchr(const void* s, int c, size_t n)
12 */
13
14PUBLIC	_memchr
15.code
16
17FUNC _memchr
18	FPO 0, 3, 4, 1, 1, FRAME_NONFPO
19	push ebp
20	mov ebp, esp
21	push edi
22	mov	edi, [ebp + 8]
23	mov	eax, [ebp + 12]
24	mov	ecx, [ebp + 16]
25	cld
26	jecxz .Lnotfound
27	repne scasb
28	je .Lfound
29.Lnotfound:
30	mov edi, 1
31.Lfound:
32	mov eax, edi
33	dec eax
34	pop edi
35	leave
36	ret
37ENDFUNC
38
39END
40