forked from KolibriOS/kolibrios
cde4fa851d
- Formatted by clang-format (WebKit-style). - Removed unnecessary errno linux. - Added KOS error codes. - String functions have been replaced with more optimal ones for x86. - Changed wrappers for 70 sysfunction. git-svn-id: svn://kolibrios.org@9765 a494cfbc-eb01-0410-851d-a64ba20cac60
21 lines
473 B
C
21 lines
473 B
C
#include "unconst.h"
|
|
#include <string.h>
|
|
|
|
char* strchr(const char* s, int c)
|
|
{
|
|
int d0;
|
|
register char* __res;
|
|
__asm__ __volatile__(
|
|
"movb %%al,%%ah\n"
|
|
"1:\tlodsb\n\t"
|
|
"cmpb %%ah,%%al\n\t"
|
|
"je 2f\n\t"
|
|
"testb %%al,%%al\n\t"
|
|
"jne 1b\n\t"
|
|
"movl $1,%1\n"
|
|
"2:\tmovl %1,%0\n\t"
|
|
"decl %0"
|
|
: "=a"(__res), "=&S"(d0)
|
|
: "1"((unsigned)s), "0"(c));
|
|
return __res;
|
|
} |