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>
This commit is contained in:
Родитель
904542dc56
Коммит
a9eb63705e
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче