Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-06-11 Thread H. Peter Anvin
Robert P. J. Day wrote: > > seriously, though, there is the potential of breaking something with > this change since you can see how there is some inconsistency in how > it's done *now* just for powerpc which, in some places, defines its > own versions of this: > > ./arch/ppc/mm/pgtable.c: >

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-06-11 Thread H. Peter Anvin
Robert P. J. Day wrote: seriously, though, there is the potential of breaking something with this change since you can see how there is some inconsistency in how it's done *now* just for powerpc which, in some places, defines its own versions of this: ./arch/ppc/mm/pgtable.c:

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-02-20 Thread Mariusz Kozlowski
Hello, > > Please fix the parentheses thing in both arch/powerpc/mm/ > > pgtable_32.c and > > arch/ppc/mm/pgtable.c. > > > >> +#define is_power_of_4(x) is_power_of_2(x) && (ffs(x) & 1)) > > These should be fixed and pushed upstream by now. Great. Thanks. Regards, Mariusz Kozlowski -

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-02-20 Thread Kumar Gala
On Feb 20, 2007, at 9:29 AM, Mariusz Kozlowski wrote: Hello, Please fix the parentheses thing in both arch/powerpc/mm/ pgtable_32.c and arch/ppc/mm/pgtable.c. +#define is_power_of_4(x) is_power_of_2(x) && (ffs(x) & 1)) These should be fixed and pushed upstream by now. - k - To

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-02-20 Thread Mariusz Kozlowski
Hello, Please fix the parentheses thing in both arch/powerpc/mm/pgtable_32.c and arch/ppc/mm/pgtable.c. > +#define is_power_of_4(x) is_power_of_2(x) && (ffs(x) & 1)) Regards, Mariusz Kozlowski - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-02-20 Thread Mariusz Kozlowski
Hello, Please fix the parentheses thing in both arch/powerpc/mm/pgtable_32.c and arch/ppc/mm/pgtable.c. +#define is_power_of_4(x) is_power_of_2(x) (ffs(x) 1)) Regards, Mariusz Kozlowski - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-02-20 Thread Kumar Gala
On Feb 20, 2007, at 9:29 AM, Mariusz Kozlowski wrote: Hello, Please fix the parentheses thing in both arch/powerpc/mm/ pgtable_32.c and arch/ppc/mm/pgtable.c. +#define is_power_of_4(x) is_power_of_2(x) (ffs(x) 1)) These should be fixed and pushed upstream by now. - k - To

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-02-20 Thread Mariusz Kozlowski
Hello, Please fix the parentheses thing in both arch/powerpc/mm/ pgtable_32.c and arch/ppc/mm/pgtable.c. +#define is_power_of_4(x) is_power_of_2(x) (ffs(x) 1)) These should be fixed and pushed upstream by now. Great. Thanks. Regards, Mariusz Kozlowski - To unsubscribe

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-02-01 Thread Tim Schmielau
On Thu, 1 Feb 2007, [EMAIL PROTECTED] wrote: > On Thu, 01 Feb 2007 13:39:15 +0100, Tim Schmielau said: > > #define is_power_of_4(x) (is_power_of_2_or_zero(x) \ > > && (x & ((typeof(x))0x))) > > Those 5's are going to need more magic if x is a 64-bit typeof?

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-02-01 Thread Valdis . Kletnieks
On Thu, 01 Feb 2007 13:39:15 +0100, Tim Schmielau said: > #define is_power_of_4(x) (is_power_of_2_or_zero(x) \ > && (x & ((typeof(x))0x))) Those 5's are going to need more magic if x is a 64-bit typeof? pgprxmSCgl3W9.pgp Description: PGP signature

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-02-01 Thread Tim Schmielau
On Thu, 1 Feb 2007, David Howells wrote: > Robert P. J. Day <[EMAIL PROTECTED]> wrote: > > > +#define is_power_of_4(x) is_power_of_2(x) && (ffs(x) & 1)) > > If this is such a commonly implemented op, it should probably be implemented > globally too. > > I also wonder if there's some better

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-02-01 Thread Robert P. J. Day
On Thu, 1 Feb 2007, David Howells wrote: > > Robert P. J. Day <[EMAIL PROTECTED]> wrote: > > > +#define is_power_of_4(x) is_power_of_2(x) && (ffs(x) & 1)) > > If this is such a commonly implemented op, it should probably be implemented > globally too. there are only two checks of the form

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-02-01 Thread David Howells
Robert P. J. Day <[EMAIL PROTECTED]> wrote: > +#define is_power_of_4(x) is_power_of_2(x) && (ffs(x) & 1)) If this is such a commonly implemented op, it should probably be implemented globally too. I also wonder if there's some better way of implementing it than this, but I can't think of

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-02-01 Thread David Howells
Nick Piggin <[EMAIL PROTECTED]> wrote: > > + * Determine whether some value is a power of two, where zero is > > + * *not* considered a power of two. > > + */ > > Why the qualifier? Zero *is* not a power of 2, is it? The qualifier is worth leaving in the comment, just so that people who want

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-02-01 Thread David Howells
Nick Piggin [EMAIL PROTECTED] wrote: + * Determine whether some value is a power of two, where zero is + * *not* considered a power of two. + */ Why the qualifier? Zero *is* not a power of 2, is it? The qualifier is worth leaving in the comment, just so that people who want to use the

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-02-01 Thread David Howells
Robert P. J. Day [EMAIL PROTECTED] wrote: +#define is_power_of_4(x) is_power_of_2(x) (ffs(x) 1)) If this is such a commonly implemented op, it should probably be implemented globally too. I also wonder if there's some better way of implementing it than this, but I can't think of one

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-02-01 Thread Robert P. J. Day
On Thu, 1 Feb 2007, David Howells wrote: Robert P. J. Day [EMAIL PROTECTED] wrote: +#define is_power_of_4(x) is_power_of_2(x) (ffs(x) 1)) If this is such a commonly implemented op, it should probably be implemented globally too. there are only two checks of the form is_power_of_4 in

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-02-01 Thread Tim Schmielau
On Thu, 1 Feb 2007, David Howells wrote: Robert P. J. Day [EMAIL PROTECTED] wrote: +#define is_power_of_4(x) is_power_of_2(x) (ffs(x) 1)) If this is such a commonly implemented op, it should probably be implemented globally too. I also wonder if there's some better way of

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-02-01 Thread Valdis . Kletnieks
On Thu, 01 Feb 2007 13:39:15 +0100, Tim Schmielau said: #define is_power_of_4(x) (is_power_of_2_or_zero(x) \ (x ((typeof(x))0x))) Those 5's are going to need more magic if x is a 64-bit typeof? pgprxmSCgl3W9.pgp Description: PGP signature

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-02-01 Thread Tim Schmielau
On Thu, 1 Feb 2007, [EMAIL PROTECTED] wrote: On Thu, 01 Feb 2007 13:39:15 +0100, Tim Schmielau said: #define is_power_of_4(x) (is_power_of_2_or_zero(x) \ (x ((typeof(x))0x))) Those 5's are going to need more magic if x is a 64-bit typeof? Yeah, I can't

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-01-31 Thread Robert P. J. Day
On Wed, 31 Jan 2007, Vegard Nossum wrote: > On Tue, January 30, 2007 3:12 pm, Jan Engelhardt wrote: > > > >>> Why the qualifier? Zero *is* not a power of 2, is it? > > > > No, it is not: > > > > In[1]:= Solve[2^n == 0, n] > > > > Out[1]= {} > > > > So says Mathematica5. > > As a side

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-01-31 Thread Vegard Nossum
On Tue, January 30, 2007 3:12 pm, Jan Engelhardt wrote: > >>> Why the qualifier? Zero *is* not a power of 2, is it? > > No, it is not: > > In[1]:= Solve[2^n == 0, n] > > Out[1]= {} > > So says Mathematica5. As a side note, I would just like to point out that Mathematica does not deal

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-01-31 Thread Vegard Nossum
On Tue, January 30, 2007 3:12 pm, Jan Engelhardt wrote: Why the qualifier? Zero *is* not a power of 2, is it? No, it is not: In[1]:= Solve[2^n == 0, n] Out[1]= {} So says Mathematica5. As a side note, I would just like to point out that Mathematica does not deal with modular

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-01-31 Thread Robert P. J. Day
On Wed, 31 Jan 2007, Vegard Nossum wrote: On Tue, January 30, 2007 3:12 pm, Jan Engelhardt wrote: Why the qualifier? Zero *is* not a power of 2, is it? No, it is not: In[1]:= Solve[2^n == 0, n] Out[1]= {} So says Mathematica5. As a side note, I would just like to

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-01-30 Thread Robert P. J. Day
On Wed, 31 Jan 2007, Nick Piggin wrote: > Robert P. J. Day wrote: > > On Tue, 30 Jan 2007, Nick Piggin wrote: > > > > > > > Robert P. J. Day wrote: > > > > > > > Add the inline function "is_power_of_2()" to log2.h, where the value > > > > zero is *not* considered to be a power of two. > > > > >

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-01-30 Thread Nick Piggin
Robert P. J. Day wrote: On Tue, 30 Jan 2007, Nick Piggin wrote: Robert P. J. Day wrote: Add the inline function "is_power_of_2()" to log2.h, where the value zero is *not* considered to be a power of two. Signed-off-by: Robert P. J. Day <[EMAIL PROTECTED]> /* + * Determine whether some

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-01-30 Thread Robert P. J. Day
On Tue, 30 Jan 2007, Jan Engelhardt wrote: > > On Jan 30 2007 09:45, Robert P. J. Day wrote: > >seriously, though, there is the potential of breaking something with > >this change since you can see how there is some inconsistency in how > >it's done *now* just for powerpc which, in some places,

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-01-30 Thread Jan Engelhardt
On Jan 30 2007 09:45, Robert P. J. Day wrote: >On Tue, 30 Jan 2007, Jan Engelhardt wrote: >> >> >> Why the qualifier? Zero *is* not a power of 2, is it? >> >> No, it is not: >> >> In[1]:= Solve[2^n == 0, n] >> >> Out[1]= {} >> >> So says Mathematica5. > >okay, that's kind of like

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-01-30 Thread Robert P. J. Day
On Tue, 30 Jan 2007, Jan Engelhardt wrote: > > >> Why the qualifier? Zero *is* not a power of 2, is it? > > No, it is not: > > In[1]:= Solve[2^n == 0, n] > > Out[1]= {} > > So says Mathematica5. okay, that's kind of like taking a sandblaster to a soup cracker. seriously, though,

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-01-30 Thread Jan Engelhardt
>> Why the qualifier? Zero *is* not a power of 2, is it? No, it is not: In[1]:= Solve[2^n == 0, n] Out[1]= {} So says Mathematica5. Jan -- ft: http://freshmeat.net/p/chaostables/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-01-30 Thread Robert P. J. Day
On Tue, 30 Jan 2007, Nick Piggin wrote: > Robert P. J. Day wrote: > > Add the inline function "is_power_of_2()" to log2.h, where the value > > zero is *not* considered to be a power of two. > > > > > Signed-off-by: Robert P. J. Day <[EMAIL PROTECTED]> > > > > /* > > + * Determine whether some

Re: [PATCH] Add "is_power_of_2" checking to log2.h.

2007-01-30 Thread Nick Piggin
Robert P. J. Day wrote: Add the inline function "is_power_of_2()" to log2.h, where the value zero is *not* considered to be a power of two. Signed-off-by: Robert P. J. Day <[EMAIL PROTECTED]> /* + * Determine whether some value is a power of two, where zero is + * *not* considered a

[PATCH] Add "is_power_of_2" checking to log2.h.

2007-01-30 Thread Robert P. J. Day
Add the inline function "is_power_of_2()" to log2.h, where the value zero is *not* considered to be a power of two. Signed-off-by: Robert P. J. Day <[EMAIL PROTECTED]> --- while people are coming up with more and more clever ways to do rounding, we can at least add the check for power-of-2

[PATCH] Add is_power_of_2 checking to log2.h.

2007-01-30 Thread Robert P. J. Day
Add the inline function is_power_of_2() to log2.h, where the value zero is *not* considered to be a power of two. Signed-off-by: Robert P. J. Day [EMAIL PROTECTED] --- while people are coming up with more and more clever ways to do rounding, we can at least add the check for power-of-2

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-01-30 Thread Nick Piggin
Robert P. J. Day wrote: Add the inline function is_power_of_2() to log2.h, where the value zero is *not* considered to be a power of two. Signed-off-by: Robert P. J. Day [EMAIL PROTECTED] /* + * Determine whether some value is a power of two, where zero is + * *not* considered a power

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-01-30 Thread Robert P. J. Day
On Tue, 30 Jan 2007, Nick Piggin wrote: Robert P. J. Day wrote: Add the inline function is_power_of_2() to log2.h, where the value zero is *not* considered to be a power of two. Signed-off-by: Robert P. J. Day [EMAIL PROTECTED] /* + * Determine whether some value is a power of

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-01-30 Thread Jan Engelhardt
Why the qualifier? Zero *is* not a power of 2, is it? No, it is not: In[1]:= Solve[2^n == 0, n] Out[1]= {} So says Mathematica5. Jan -- ft: http://freshmeat.net/p/chaostables/ - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-01-30 Thread Robert P. J. Day
On Tue, 30 Jan 2007, Jan Engelhardt wrote: Why the qualifier? Zero *is* not a power of 2, is it? No, it is not: In[1]:= Solve[2^n == 0, n] Out[1]= {} So says Mathematica5. okay, that's kind of like taking a sandblaster to a soup cracker. seriously, though, there is

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-01-30 Thread Jan Engelhardt
On Jan 30 2007 09:45, Robert P. J. Day wrote: On Tue, 30 Jan 2007, Jan Engelhardt wrote: Why the qualifier? Zero *is* not a power of 2, is it? No, it is not: In[1]:= Solve[2^n == 0, n] Out[1]= {} So says Mathematica5. okay, that's kind of like taking a sandblaster to a

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-01-30 Thread Robert P. J. Day
On Tue, 30 Jan 2007, Jan Engelhardt wrote: On Jan 30 2007 09:45, Robert P. J. Day wrote: seriously, though, there is the potential of breaking something with this change since you can see how there is some inconsistency in how it's done *now* just for powerpc which, in some places, defines

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-01-30 Thread Nick Piggin
Robert P. J. Day wrote: On Tue, 30 Jan 2007, Nick Piggin wrote: Robert P. J. Day wrote: Add the inline function is_power_of_2() to log2.h, where the value zero is *not* considered to be a power of two. Signed-off-by: Robert P. J. Day [EMAIL PROTECTED] /* + * Determine whether some

Re: [PATCH] Add is_power_of_2 checking to log2.h.

2007-01-30 Thread Robert P. J. Day
On Wed, 31 Jan 2007, Nick Piggin wrote: Robert P. J. Day wrote: On Tue, 30 Jan 2007, Nick Piggin wrote: Robert P. J. Day wrote: Add the inline function is_power_of_2() to log2.h, where the value zero is *not* considered to be a power of two. Signed-off-by: Robert P.