diff options
author | Rolf Eike Beer <eike-kernel@sf-tec.de> | 2007-05-17 17:56:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-18 23:46:30 -0400 |
commit | 1a06a52ee1b0cdb65222474ba6186f3991df68b0 (patch) | |
tree | 91ce623fbfdd72e32fa0001d7ba611bb6c7de50f /include/linux | |
parent | 18963c01b8abf381f102752ce024c3582a716125 (diff) |
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>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/log2.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/log2.h b/include/linux/log2.h index 57e641e19a81..1b8a2c1cb0e3 100644 --- a/include/linux/log2.h +++ b/include/linux/log2.h | |||
@@ -159,7 +159,7 @@ unsigned long __roundup_pow_of_two(unsigned long n) | |||
159 | #define roundup_pow_of_two(n) \ | 159 | #define roundup_pow_of_two(n) \ |
160 | ( \ | 160 | ( \ |
161 | __builtin_constant_p(n) ? ( \ | 161 | __builtin_constant_p(n) ? ( \ |
162 | (n == 1) ? 0 : \ | 162 | (n == 1) ? 1 : \ |
163 | (1UL << (ilog2((n) - 1) + 1)) \ | 163 | (1UL << (ilog2((n) - 1) + 1)) \ |
164 | ) : \ | 164 | ) : \ |
165 | __roundup_pow_of_two(n) \ | 165 | __roundup_pow_of_two(n) \ |