diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2020-06-02 10:54:08 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-06-03 10:03:34 +0200 |
commit | 201c017f96a4b249f2d6a0bf4892b90b05c4a3b6 (patch) | |
tree | a0d9a4bf6a5bbe7bbb676e4058cc691ccd1a1b7d | |
parent | 6980fc752728ead45aee71340c242956cf15c590 (diff) | |
download | barebox-201c017f96a4b249f2d6a0bf4892b90b05c4a3b6.tar.gz barebox-201c017f96a4b249f2d6a0bf4892b90b05c4a3b6.tar.xz |
include: bitops: fix dead increment in fls() and ffs()
Static analyzers trip over this dead increment. It arguably
doesn't improve readability, so just drop the dead code.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | include/asm-generic/bitops/ffs.h | 4 | ||||
-rw-r--r-- | include/asm-generic/bitops/fls.h | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/include/asm-generic/bitops/ffs.h b/include/asm-generic/bitops/ffs.h index fbbb43af7d..0ff1b8b7c7 100644 --- a/include/asm-generic/bitops/ffs.h +++ b/include/asm-generic/bitops/ffs.h @@ -31,10 +31,8 @@ static inline int ffs(int x) x >>= 2; r += 2; } - if (!(x & 1)) { - x >>= 1; + if (!(x & 1)) r += 1; - } return r; } diff --git a/include/asm-generic/bitops/fls.h b/include/asm-generic/bitops/fls.h index 850859bc50..cc0d3ca95a 100644 --- a/include/asm-generic/bitops/fls.h +++ b/include/asm-generic/bitops/fls.h @@ -31,10 +31,8 @@ static inline int fls(int x) x <<= 2; r -= 2; } - if (!(x & 0x80000000u)) { - x <<= 1; + if (!(x & 0x80000000u)) r -= 1; - } return r; } |