diff options
Diffstat (limited to 'src/lib/libc/string/ffs.c')
-rw-r--r-- | src/lib/libc/string/ffs.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/lib/libc/string/ffs.c b/src/lib/libc/string/ffs.c deleted file mode 100644 index 09d6e35eca..0000000000 --- a/src/lib/libc/string/ffs.c +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* $OpenBSD: ffs.c,v 1.10 2018/01/18 08:23:44 guenther Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Public domain. | ||
5 | * Written by Dale Rahn. | ||
6 | */ | ||
7 | |||
8 | #include <string.h> | ||
9 | |||
10 | /* | ||
11 | * ffs -- vax ffs instruction | ||
12 | */ | ||
13 | int | ||
14 | ffs(int mask) | ||
15 | { | ||
16 | int bit; | ||
17 | unsigned int r = mask; | ||
18 | static const signed char t[16] = { | ||
19 | -28, 1, 2, 1, | ||
20 | 3, 1, 2, 1, | ||
21 | 4, 1, 2, 1, | ||
22 | 3, 1, 2, 1 | ||
23 | }; | ||
24 | |||
25 | bit = 0; | ||
26 | if (!(r & 0xffff)) { | ||
27 | bit += 16; | ||
28 | r >>= 16; | ||
29 | } | ||
30 | if (!(r & 0xff)) { | ||
31 | bit += 8; | ||
32 | r >>= 8; | ||
33 | } | ||
34 | if (!(r & 0xf)) { | ||
35 | bit += 4; | ||
36 | r >>= 4; | ||
37 | } | ||
38 | |||
39 | return (bit + t[ r & 0xf ]); | ||
40 | } | ||