Re: [KERNEL]: Avoid divide in IS_ALIGN

2007-11-21 Thread Andreas Schwab
"linux-os (Dick Johnson)" <[EMAIL PROTECTED]> writes: > Executing this script. > > cat #include > > #define IS_ALIGNED(x,a) (((x) % ((typeof(x))(a))) == 0) > #define _IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) > > int main() > { > int i; >

Re: [KERNEL]: Avoid divide in IS_ALIGN

2007-11-21 Thread linux-os (Dick Johnson)
On Tue, 20 Nov 2007, Richard B. Johnson wrote: > On Tue, 20 Nov 2007, Herbert Xu wrote: > >> Hi: >> >> [KERNEL]: Avoid divide in IS_ALIGN >> >> I was happy to discover the brand new IS_ALIGN macro and quickly >> used it in my code. To my dismay I foun

Re: [KERNEL]: Avoid divide in IS_ALIGN

2007-11-20 Thread linux-os (Dick Johnson)
On Tue, 20 Nov 2007, Herbert Xu wrote: > Hi: > > [KERNEL]: Avoid divide in IS_ALIGN > > I was happy to discover the brand new IS_ALIGN macro and quickly > used it in my code. To my dismay I found that the generated code > used division to perform the test. > > This

Re: [KERNEL]: Avoid divide in IS_ALIGN

2007-11-20 Thread Andrew Morton
On Tue, 20 Nov 2007 10:17:15 -0800 Joe Perches <[EMAIL PROTECTED]> wrote: > On Tue, 2007-11-20 at 21:56 +0800, Herbert Xu wrote: > > [KERNEL]: Avoid divide in IS_ALIGN > > I was happy to discover the brand new IS_ALIGN macro and quickly > > used it in my code. To

Re: [KERNEL]: Avoid divide in IS_ALIGN

2007-11-20 Thread Joe Perches
On Tue, 2007-11-20 at 21:56 +0800, Herbert Xu wrote: > [KERNEL]: Avoid divide in IS_ALIGN > I was happy to discover the brand new IS_ALIGN macro and quickly > used it in my code. To my dismay I found that the generated code > used division to perform the test. > This patch fixes

[KERNEL]: Avoid divide in IS_ALIGN

2007-11-20 Thread Herbert Xu
Hi: [KERNEL]: Avoid divide in IS_ALIGN I was happy to discover the brand new IS_ALIGN macro and quickly used it in my code. To my dismay I found that the generated code used division to perform the test. This patch fixes it by changing the % test to an &. This avoids the division. Signed