lkml.org 
[lkml]   [2007]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: ALIGN (Re: [PATCH] Fix get_order())
From
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 simple.
>
> The current ALIGN() macro is efficient as hell (generating just a simple
> mask+add). Turning it into some kind of horrible thing that uses ilog2()
> would be a total mistake.

OTOH, if i would write it this way

#define BALIGN(x,bits) ((((x) >> (bits)) + 1) << (bits))

that would give more convenient way of expessing alignment (values of
what are most widely used, i.e powers of two) without log2(:)
requirement, no?

arch/powerpc/mm/hugetlbpage.c: addr = ALIGN(addr+1,1UL<<HTLB_AREA_SHIFT);
arch/powerpc/mm/hugetlbpage.c: addr = ALIGN(addr+1,1<<SID_SHIFT);

But it's not conventional, of course, and name is ugly.
____
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-03-10 00:07    [W:0.075 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site