summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/ffs.c
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2008-07-28 23:44:12 +0000
committercvs2svn <admin@example.com>2008-07-28 23:44:12 +0000
commitdaac2f633f49a45baa8412c5e4e71e594236e7b8 (patch)
treec2b7593b6807015d5bd1bbe95841e718a3b3df42 /src/lib/libc/string/ffs.c
parent10837c3c47f1b9d7d1a061fff2327a4e280ba338 (diff)
downloadopenbsd-pre_openssl_0_9_8h.tar.gz
openbsd-pre_openssl_0_9_8h.tar.bz2
openbsd-pre_openssl_0_9_8h.zip
This commit was manufactured by cvs2git to create tag 'pre_openssl_0_9_8h'.pre_openssl_0_9_8h
Diffstat (limited to 'src/lib/libc/string/ffs.c')
-rw-r--r--src/lib/libc/string/ffs.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/lib/libc/string/ffs.c b/src/lib/libc/string/ffs.c
deleted file mode 100644
index 7dec1613a8..0000000000
--- a/src/lib/libc/string/ffs.c
+++ /dev/null
@@ -1,44 +0,0 @@
1/* $OpenBSD: ffs.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */
2
3/*
4 * Public domain.
5 * Written by Dale Rahn.
6 */
7
8#if !defined(_KERNEL) && !defined(_STANDALONE)
9#include <string.h>
10#else
11#include <lib/libkern/libkern.h>
12#endif
13
14/*
15 * ffs -- vax ffs instruction
16 */
17int
18ffs(int mask)
19{
20 int bit;
21 unsigned int r = mask;
22 static const signed char t[16] = {
23 -28, 1, 2, 1,
24 3, 1, 2, 1,
25 4, 1, 2, 1,
26 3, 1, 2, 1
27 };
28
29 bit = 0;
30 if (!(r & 0xffff)) {
31 bit += 16;
32 r >>= 16;
33 }
34 if (!(r & 0xff)) {
35 bit += 8;
36 r >>= 8;
37 }
38 if (!(r & 0xf)) {
39 bit += 4;
40 r >>= 4;
41 }
42
43 return (bit + t[ r & 0xf ]);
44}