Commit a9eb6370 authored by Wei Yang's avatar Wei Yang Committed by Linus Torvalds

bitops: simplify get_count_order_long()

These two cases could be unified into one.
Signed-off-by: default avatarWei Yang <richard.weiyang@linux.alibaba.com>
Signed-off-by: default avatarAndrew 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.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 904542dc
...@@ -206,10 +206,7 @@ static inline int get_count_order_long(unsigned long l) ...@@ -206,10 +206,7 @@ static inline int get_count_order_long(unsigned long l)
{ {
if (l == 0UL) if (l == 0UL)
return -1; return -1;
else if (l & (l - 1UL)) return (int)fls_long(--l);
return (int)fls_long(l);
else
return (int)fls_long(l) - 1;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment