summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/ffs.c
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2012-07-13 17:49:56 +0000
committercvs2svn <admin@example.com>2012-07-13 17:49:56 +0000
commit6f82d0e8f9756938f04071892206a5af85e676f0 (patch)
tree821921a1dd0a5a3cece91121e121cc63c4b68128 /src/lib/libc/string/ffs.c
parent9204e59073bcf27e1487ec4ac46e981902ddd904 (diff)
downloadopenbsd-eric_g2k12.tar.gz
openbsd-eric_g2k12.tar.bz2
openbsd-eric_g2k12.zip
This commit was manufactured by cvs2git to create tag 'eric_g2k12'.eric_g2k12
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}