summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorGiuseppe Cavallaro <peppe.cavallaro@st.com>2009-06-18 10:38:06 +0200
committerCarmelo Amoroso <carmelo.amoroso@st.com>2009-09-27 09:58:52 +0200
commit905c5ab688ad9a5cff7e014884ed6e995cee51ca (patch)
tree80b4b301655d3808269e93420f7ce0ccf79618d7 /libc
parentaf2e5dd9301f2659e6edbad8264d1260537b9cee (diff)
downloaduClibc-alpine-905c5ab688ad9a5cff7e014884ed6e995cee51ca.tar.bz2
uClibc-alpine-905c5ab688ad9a5cff7e014884ed6e995cee51ca.tar.xz
sh: add assembly memchr from Kernel
Faster assembly implementation of memchr taken from Linux kernel. Adapted to uClibc. Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libc')
-rw-r--r--libc/string/sh/memchr.S30
1 files changed, 30 insertions, 0 deletions
diff --git a/libc/string/sh/memchr.S b/libc/string/sh/memchr.S
new file mode 100644
index 000000000..6b7142f69
--- /dev/null
+++ b/libc/string/sh/memchr.S
@@ -0,0 +1,30 @@
+/* $Id: memchr.S,v 1.1 2000/04/14 16:49:01 mjd Exp $
+ *
+ * "memchr" implementation of SuperH
+ *
+ * Copyright (C) 1999 Niibe Yutaka
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * void *memchr(const void *s, int c, size_t n);
+ */
+
+#include <sysdep.h>
+
+ENTRY(memchr)
+ tst r6,r6
+ bt/s 2f
+ exts.b r5,r5
+1: mov.b @r4,r1
+ cmp/eq r1,r5
+ bt/s 3f
+ dt r6
+ bf/s 1b
+ add #1,r4
+2: mov #0,r4
+3: rts
+ mov r4,r0
+END(memchr)
+libc_hidden_def (memchr)