diff options
| author | cvs2svn <admin@example.com> | 2021-08-18 16:06:57 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2021-08-18 16:06:57 +0000 |
| commit | d56c8fa8260d226f98b26f017b45b9c2b135f38d (patch) | |
| tree | 348178b41617813cc93787187984a734ef8379ca /src/lib/libc/string/ffs.c | |
| parent | 18b9c1bcab7c37d8c5bd05b8e0d14d0c59d96650 (diff) | |
| download | openbsd-tb_20210818.tar.gz openbsd-tb_20210818.tar.bz2 openbsd-tb_20210818.zip | |
This commit was manufactured by cvs2git to create tag 'tb_20210818'.tb_20210818
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 | } | ||
