summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-06-02 10:54:08 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-06-03 10:03:34 +0200
commit201c017f96a4b249f2d6a0bf4892b90b05c4a3b6 (patch)
treea0d9a4bf6a5bbe7bbb676e4058cc691ccd1a1b7d
parent6980fc752728ead45aee71340c242956cf15c590 (diff)
downloadbarebox-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.h4
-rw-r--r--include/asm-generic/bitops/fls.h4
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;
}