Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <eike-kernel@sf-tec.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Rolf Eike Beer and committed by
Linus Torvalds
1a06a52e 18963c01

+1 -1
+1 -1
include/linux/log2.h
··· 159 159 #define roundup_pow_of_two(n) \ 160 160 ( \ 161 161 __builtin_constant_p(n) ? ( \ 162 - (n == 1) ? 0 : \ 162 + (n == 1) ? 1 : \ 163 163 (1UL << (ilog2((n) - 1) + 1)) \ 164 164 ) : \ 165 165 __roundup_pow_of_two(n) \