From: Jens Axboe Date: Mon, 2 Jun 2008 11:31:26 +0000 (+0200) Subject: Move fls.h in with the other lib helpers X-Git-Tag: fio-1.21-rc7~7 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=eef323596c6c9d39456aba10954bb47c21982d96;p=fio.git Move fls.h in with the other lib helpers Signed-off-by: Jens Axboe --- diff --git a/engines/syslet-rw.c b/engines/syslet-rw.c index 4b3e5ef4..2eab207c 100644 --- a/engines/syslet-rw.c +++ b/engines/syslet-rw.c @@ -14,7 +14,7 @@ #include #include "../fio.h" -#include "../fls.h" +#include "../lib/fls.h" #ifdef FIO_HAVE_SYSLET diff --git a/fls.h b/fls.h deleted file mode 100644 index dc7ecd0d..00000000 --- a/fls.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _ASM_GENERIC_BITOPS_FLS_H_ -#define _ASM_GENERIC_BITOPS_FLS_H_ - -/** - * fls - find last (most-significant) bit set - * @x: the word to search - * - * This is defined the same way as ffs. - * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. - */ - -static inline int __fls(int x) -{ - int r = 32; - - if (!x) - return 0; - if (!(x & 0xffff0000u)) { - x <<= 16; - r -= 16; - } - if (!(x & 0xff000000u)) { - x <<= 8; - r -= 8; - } - if (!(x & 0xf0000000u)) { - x <<= 4; - r -= 4; - } - if (!(x & 0xc0000000u)) { - x <<= 2; - r -= 2; - } - if (!(x & 0x80000000u)) { - x <<= 1; - r -= 1; - } - return r; -} - -#endif /* _ASM_GENERIC_BITOPS_FLS_H_ */ diff --git a/lib/fls.h b/lib/fls.h new file mode 100644 index 00000000..dc7ecd0d --- /dev/null +++ b/lib/fls.h @@ -0,0 +1,41 @@ +#ifndef _ASM_GENERIC_BITOPS_FLS_H_ +#define _ASM_GENERIC_BITOPS_FLS_H_ + +/** + * fls - find last (most-significant) bit set + * @x: the word to search + * + * This is defined the same way as ffs. + * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. + */ + +static inline int __fls(int x) +{ + int r = 32; + + if (!x) + return 0; + if (!(x & 0xffff0000u)) { + x <<= 16; + r -= 16; + } + if (!(x & 0xff000000u)) { + x <<= 8; + r -= 8; + } + if (!(x & 0xf0000000u)) { + x <<= 4; + r -= 4; + } + if (!(x & 0xc0000000u)) { + x <<= 2; + r -= 2; + } + if (!(x & 0x80000000u)) { + x <<= 1; + r -= 1; + } + return r; +} + +#endif /* _ASM_GENERIC_BITOPS_FLS_H_ */ diff --git a/options.c b/options.c index 3c37e910..b3986959 100644 --- a/options.c +++ b/options.c @@ -12,7 +12,7 @@ #include "fio.h" #include "parse.h" -#include "fls.h" +#include "lib/fls.h" #define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var)