mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 22:37:45 -04:00
Fix roundup_pow_of_two(1)
1 is a power of two, therefore roundup_pow_of_two(1) should return 1. It does in case the argument is a variable but in case it's a constant it behaves wrong and returns 0. Probably nobody ever did it so this was never noticed. Signed-off-by: Rolf Eike Beer <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
18963c01b8
commit
1a06a52ee1
1 file changed
+1
-1
@@ -159,7 +159,7 @@ unsigned long __roundup_pow_of_two(unsigned long n)
|
||||
#define roundup_pow_of_two(n) \
|
||||
( \
|
||||
__builtin_constant_p(n) ? ( \
|
||||
(n == 1) ? 0 : \
|
||||
(n == 1) ? 1 : \
|
||||
(1UL << (ilog2((n) - 1) + 1)) \
|
||||
) : \
|
||||
__roundup_pow_of_two(n) \
|
||||
|
||||
Reference in new issue
Block a user