aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yang <richard.weiyang@linux.alibaba.com>2020-10-15 20:11:41 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-10-16 11:11:20 -0700
commita9eb63705e379f10a3c9d13fc6aee8b50805e862 (patch)
treeb3e47aed1f0e56c0b7bf73cdfbff919df59ea5d4
parent904542dc56524f921a6bab0639ff6249c01e775f (diff)
downloadlinux-a9eb63705e379f10a3c9d13fc6aee8b50805e862.tar.gz
bitops: simplify get_count_order_long()
These two cases could be unified into one. Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Christian Brauner <christian.brauner@ubuntu.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lkml.kernel.org/r/20200807085837.11697-2-richard.weiyang@linux.alibaba.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-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 99f2ac30b1d9b..030a98f0c4528 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);
}
/**