files
kolibrios/programs/develop/ktcc/libc.obj/source/string/memchr.c
Andrew 42e77931bf
Some checks failed
Build system / Check kernel codestyle (pull_request) Successful in 25s
Build system / Build (pull_request) Failing after 27s
develop/ktcc: Post-SVN tidy
- Move source code from `trunk` into program root directory.
- Update build files.
2025-05-24 11:48:18 +01:00

20 lines
417 B
C

#include <assert.h>
#include "unconst.h"
#include <string.h>
void* memchr(const void* s, int c, size_t n)
{
int d0;
register void* __res;
if (!n)
return NULL;
__asm__ __volatile__(
"repne\n\t"
"scasb\n\t"
"je 1f\n\t"
"movl $1,%0\n"
"1:\tdecl %0"
: "=D"(__res), "=&c"(d0)
: "a"(c), "0"(s), "1"(n));
return __res;
}