diff options
author | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
---|---|---|
committer | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
commit | eb8dd9dca1228af0cd132f515509051ecfabf6f6 (patch) | |
tree | edb6da6af7e865d488dc1a29309f1e1ec226e603 /src/lib/libc/string/ffs.c | |
parent | 247f0352e0ed72a4f476db9dc91f4d982bc83eb2 (diff) | |
download | openbsd-tb_20250414.tar.gz openbsd-tb_20250414.tar.bz2 openbsd-tb_20250414.zip |
This commit was manufactured by cvs2git to create tag 'tb_20250414'.tb_20250414
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 | } | ||