Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include<string.h>
  2. #include<libc/unconst.h>
  3. #include<assert.h>
  4.  
  5. void * memchr(const void *s, int c, size_t n)
  6. {
  7.  int d0;
  8.  register void * __res;
  9.  if (!n) return NULL;
  10.  __asm__ __volatile__(
  11.         "repne\n\t"
  12.         "scasb\n\t"
  13.         "je 1f\n\t"
  14.         "movl $1,%0\n"
  15.         "1:\tdecl %0"
  16.         :"=D" (__res), "=&c" (d0) : "a" (c),"0" (s),"1" (n));
  17.  return __res;
  18. }
  19.