This commit was manufactured by cvs2svn to create branch 'captive'.
[reactos.git] / lib / string / i386 / memchr.s
diff --git a/lib/string/i386/memchr.s b/lib/string/i386/memchr.s
new file mode 100644 (file)
index 0000000..f044a1d
--- /dev/null
@@ -0,0 +1,31 @@
+/* $Id$
+ *
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            lib/string/i386/memchr.s
+ */
+
+/*
+ * void* memchr(const void* s, int c, size_t n)
+ */
+
+.globl _memchr
+
+_memchr:
+       push    %ebp
+       mov     %esp,%ebp
+       push    %edi
+       mov     0x8(%ebp),%edi
+       mov     0xc(%ebp),%eax
+       mov     0x10(%ebp),%ecx
+       cld
+       repne   scasb
+       je      .L1
+       mov     $1,%edi
+.L1:
+       mov     %edi,%eax
+       dec     %eax
+       pop     %edi
+       leave
+       ret
+