home *** CD-ROM | disk | FTP | other *** search
- / strchr.s (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes
-
- .globl _strchr
-
- / char *strchr (const char *string, int c)
- / {
- / do
- / {
- / if (*string == (char)c)
- / return ((char *)string);
- / } while (*string++ != 0);
- / return (NULL);
- / }
-
- .text
-
- .align 2, 0x90
-
- _strchr:
- pushl %esi
- movl 2*4(%esp), %esi / string
- movb 3*4(%esp), %ah / c
- .align 2, 0x90
- 1: lodsb
- cmpb %ah, %al
- jz 2f
- orb %al, %al
- jnz 1b
- xorl %eax, %eax
- popl %esi
- ret
-
- .align 2, 0x90
- 2: lea -1(%esi), %eax
- popl %esi
- ret
-