summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-01-26 20:05:30 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-01-26 20:05:30 +0000
commitc090f46968d36be6aa1807b09960dd5e1d2d38d9 (patch)
tree6cdfd4a689017e61e7b10794c2287debd9b3681b
parentba5fd48547f62b5f620d0dc6e241729046cf3fe4 (diff)
Use libkern's fast ffs() in libc too.
-rw-r--r--lib/libc/arch/m88k/string/Makefile.inc4
-rw-r--r--lib/libc/arch/m88k/string/ffs.S16
2 files changed, 18 insertions, 2 deletions
diff --git a/lib/libc/arch/m88k/string/Makefile.inc b/lib/libc/arch/m88k/string/Makefile.inc
index e40cf017c08..7b2bddad6c5 100644
--- a/lib/libc/arch/m88k/string/Makefile.inc
+++ b/lib/libc/arch/m88k/string/Makefile.inc
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile.inc,v 1.3 2002/05/17 06:58:20 miod Exp $
+# $OpenBSD: Makefile.inc,v 1.4 2004/01/26 20:05:29 miod Exp $
# $NetBSD: Makefile.inc,v 1.1 1995/03/20 14:45:45 mycroft Exp $
-SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memchr.c memcmp.c memset.c \
+SRCS+= bcmp.c bcopy.c bzero.c ffs.S index.c memchr.c memcmp.c memset.c \
rindex.c strcat.c strcmp.c strcpy.c strcspn.c strlcpy.c strlen.c \
strncat.c strncmp.c strncpy.c strpbrk.c strsep.c \
strspn.c strstr.c swab.c
diff --git a/lib/libc/arch/m88k/string/ffs.S b/lib/libc/arch/m88k/string/ffs.S
new file mode 100644
index 00000000000..b851d315749
--- /dev/null
+++ b/lib/libc/arch/m88k/string/ffs.S
@@ -0,0 +1,16 @@
+/* $OpenBSD: ffs.S,v 1.1 2004/01/26 20:05:29 miod Exp $ */
+
+/*
+ * Written by Miodrag Vallat, 2004 - Public Domain
+ */
+
+#include "DEFS.h"
+
+ENTRY(ffs)
+ bcnd eq0, r2, 1f /* ff1(0) = 32, treat differently */
+ ff1 r3, r2
+ jmp.n r1
+ add r2, r3, 1 /* ff1 returns 0-31, need to increment */
+1:
+ jmp.n r1
+ or r2, r0, r0