diff options
author | Wei Yang <richard.weiyang@linux.alibaba.com> | 2020-10-15 20:11:41 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-10-16 11:11:20 -0700 |
commit | a9eb63705e379f10a3c9d13fc6aee8b50805e862 (patch) | |
tree | b3e47aed1f0e56c0b7bf73cdfbff919df59ea5d4 /include/linux/bitops.h | |
parent | 904542dc56524f921a6bab0639ff6249c01e775f (diff) | |
download | linux-a9eb63705e379f10a3c9d13fc6aee8b50805e862.tar.gz linux-a9eb63705e379f10a3c9d13fc6aee8b50805e862.tar.bz2 linux-a9eb63705e379f10a3c9d13fc6aee8b50805e862.zip |
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>
Diffstat (limited to 'include/linux/bitops.h')
-rw-r--r-- | include/linux/bitops.h | 5 |
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); } /** |