aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei Yang <[email protected]>2020-10-15 20:11:41 -0700
committerLinus Torvalds <[email protected]>2020-10-16 11:11:20 -0700
commita9eb63705e379f10a3c9d13fc6aee8b50805e862 (patch)
treeb3e47aed1f0e56c0b7bf73cdfbff919df59ea5d4
parent904542dc56524f921a6bab0639ff6249c01e775f (diff)
bitops: simplify get_count_order_long()
These two cases could be unified into one. Signed-off-by: Wei Yang <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Andy Shevchenko <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--include/linux/bitops.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 99f2ac30b1d9..030a98f0c452 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -206,10 +206,7 @@ static inline int get_count_order_long(unsigned long l)
{
if (l == 0UL)
return -1;
- else if (l & (l - 1UL))
- return (int)fls_long(l);
- else
- return (int)fls_long(l) - 1;
+ return (int)fls_long(--l);
}
/**