Re: [PATCH] Fix get_order() [try #2]

2007-03-06 Thread David Howells
Alexey Dobriyan <[EMAIL PROTECTED]> wrote: > > #if BITS_PER_LONG == 32 && defined(ARCH_HAS_ILOG2_U32) > > There is no such thing except on FRV, where it's redundant. Redundant in what way? > CONFIG_ARCH_HAS_ILOG2_U32 > ^^^

Re: [PATCH] Fix get_order() [try #2]

2007-03-06 Thread Alexey Dobriyan
On Tue, Mar 06, 2007 at 06:34:26PM +, David Howells wrote: > Provide an ilog2_up() that rounds its result up (ilog2() rounds down). > > Fix get_order() to use ilog2_up() not ilog2() to get the correct rounding. > > Adjust the documentation surrounding ilog2() and co. to indicate what rounding >

Re: [PATCH] Fix get_order() [try #2]

2007-03-06 Thread H. Peter Anvin
David Howells wrote: H. Peter Anvin <[EMAIL PROTECTED]> wrote: Why not just make it ((n) < 1 ? 0 : ...) and make it well-defined for n == 0? Because log2(0) is -INF or mathematically undefined or something isn't it? Yes, but it's a *rounding up* function. In this case, it makes sense to r

Re: [PATCH] Fix get_order() [try #2]

2007-03-06 Thread David Howells
H. Peter Anvin <[EMAIL PROTECTED]> wrote: > Why not just make it ((n) < 1 ? 0 : ...) and make it well-defined for > n == 0? Because log2(0) is -INF or mathematically undefined or something isn't it? David - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a

Re: [PATCH] Fix get_order() [try #2]

2007-03-06 Thread David Howells
H. Peter Anvin <[EMAIL PROTECTED]> wrote: > Eh? roundup_pow_of_two(1) should be 0; 2^0 = 1. Nonono. roundup_pow_of_two(0) => ? roundup_pow_of_two(1) => 1 roundup_pow_of_two(2) => 2 roundup_pow_of_two(3) => 4 roundup_pow_of_two(4) => 4 roundup_

Re: [PATCH] Fix get_order() [try #2]

2007-03-06 Thread H. Peter Anvin
David Howells wrote: /** + * ilog2_up - rounded up log of base 2 of 32-bit or a 64-bit unsigned value + * @n - parameter + * + * constant-capable log of base 2 calculation + * - this can be used to initialise global variables from constant data, hence + * the massive ternary operator constru

Re: [PATCH] Fix get_order() [try #2]

2007-03-06 Thread H. Peter Anvin
David Howells wrote: From: David Howells <[EMAIL PROTECTED]> Provide an ilog2_up() that rounds its result up (ilog2() rounds down). Fix get_order() to use ilog2_up() not ilog2() to get the correct rounding. Adjust the documentation surrounding ilog2() and co. to indicate what rounding they per

[PATCH] Fix get_order() [try #2]

2007-03-06 Thread David Howells
From: David Howells <[EMAIL PROTECTED]> Provide an ilog2_up() that rounds its result up (ilog2() rounds down). Fix get_order() to use ilog2_up() not ilog2() to get the correct rounding. Adjust the documentation surrounding ilog2() and co. to indicate what rounding they perform. Fix roundup_pow_