summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2004-01-26 20:05:29 +0000
committermiod <miod@openbsd.org>2004-01-26 20:05:29 +0000
commit15d1ec5d30ceebc4c1addb2e30309472c3d7f876 (patch)
tree9a24d3964e959b5202d3594b7ce4736df3636da5 /lib/libc
parentadd finalized guard to destructor calls, to prevent multiple calls. (diff)
downloadwireguard-openbsd-15d1ec5d30ceebc4c1addb2e30309472c3d7f876.tar.xz
wireguard-openbsd-15d1ec5d30ceebc4c1addb2e30309472c3d7f876.zip
Use libkern's fast ffs() in libc too.
Diffstat (limited to 'lib/libc')
-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