Re: ALIGN (Re: [PATCH] Fix get_order())

2007-03-09 Thread Oleg Verych
On Fri, Mar 09, 2007 at 03:15:10PM -0800, Linus Torvalds wrote: > > > On Sat, 10 Mar 2007, Oleg Verych wrote: > > > > OTOH, if i would write it this way > > > > #define BALIGN(x,bits) x) >> (bits)) + 1) << (bits)) > > But that's *wrong*. It aligns something that is *already* aligned

Re: ALIGN (Re: [PATCH] Fix get_order())

2007-03-09 Thread Linus Torvalds
On Sat, 10 Mar 2007, Oleg Verych wrote: > > OTOH, if i would write it this way > > #define BALIGN(x,bits) x) >> (bits)) + 1) << (bits)) But that's *wrong*. It aligns something that is *already* aligned to something else. So you'd have to do it as something like #define

Re: ALIGN (Re: [PATCH] Fix get_order())

2007-03-09 Thread Oleg Verych
On Wed, Mar 07, 2007 at 08:38:27AM -0800, Linus Torvalds wrote: > > > On Wed, 7 Mar 2007, Oleg Verych wrote: > > > > Probably it can be used to get rid of gccisms and "type fluff" due to > > bitwise arithmetics in ALIGN? > > Hell no. > > The typeof is there to make sure we have the right type,

Re: ALIGN (Re: [PATCH] Fix get_order())

2007-03-09 Thread Oleg Verych
On Wed, Mar 07, 2007 at 08:38:27AM -0800, Linus Torvalds wrote: On Wed, 7 Mar 2007, Oleg Verych wrote: Probably it can be used to get rid of gccisms and type fluff due to bitwise arithmetics in ALIGN? Hell no. The typeof is there to make sure we have the right type, and it's

Re: ALIGN (Re: [PATCH] Fix get_order())

2007-03-09 Thread Linus Torvalds
On Sat, 10 Mar 2007, Oleg Verych wrote: OTOH, if i would write it this way #define BALIGN(x,bits) x) (bits)) + 1) (bits)) But that's *wrong*. It aligns something that is *already* aligned to something else. So you'd have to do it as something like #define

Re: ALIGN (Re: [PATCH] Fix get_order())

2007-03-09 Thread Oleg Verych
On Fri, Mar 09, 2007 at 03:15:10PM -0800, Linus Torvalds wrote: On Sat, 10 Mar 2007, Oleg Verych wrote: OTOH, if i would write it this way #define BALIGN(x,bits) x) (bits)) + 1) (bits)) But that's *wrong*. It aligns something that is *already* aligned to something