From: Dave Hansen <haveblue@us.ibm.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [RFC][PATCH 01/10] put alignment macros in align.h
Date: Wed, 30 Aug 2006 16:48:49 +0000 [thread overview]
Message-ID: <1156956529.12898.10.camel@localhost.localdomain> (raw)
In-Reply-To: <20060829201934.A5363374@localhost.localdomain>
On Wed, 2006-08-30 at 20:11 +0400, Nikita Danilov wrote:
> Dave Hansen writes:
> > + */
> > +#ifndef __ASSEMBLY__
> > +#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
>
> This evaluates (a) twice. While in all existing call-sites (a) is
> probably a constant, it's still safer to do
>
> #define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); })
>
> in a generic macro and rely on compiler to optimize temporary variable
> out.
Looks great to me. I'll incorporate it for the next version.
-- Dave
next prev parent reply other threads:[~2006-08-30 16:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-29 20:19 [RFC][PATCH 00/10] generic PAGE_SIZE infrastructure (v3) Dave Hansen
2006-08-29 20:19 ` [RFC][PATCH 01/10] put alignment macros in align.h Dave Hansen
2006-08-30 16:11 ` Nikita Danilov
2006-08-30 16:48 ` Dave Hansen [this message]
2006-08-29 20:19 ` [RFC][PATCH 02/10] conditionally define generic get_order() (ARCH_HAS_GET_ORDER) Dave Hansen
2006-08-30 10:20 ` Paul Mundt
2006-08-29 20:19 ` [RFC][PATCH 03/10] actual generic PAGE_SIZE infrastructure Dave Hansen
2006-08-29 20:19 ` [RFC][PATCH 05/10] ia64 generic PAGE_SIZE Dave Hansen
2006-08-29 20:19 ` [RFC][PATCH 04/10] replace _ALIGN() Dave Hansen
2006-08-29 20:19 ` [RFC][PATCH 06/10] sparc64 generic PAGE_SIZE Dave Hansen
2006-08-29 21:33 ` Dave Hansen
2006-08-29 20:19 ` [RFC][PATCH 07/10] mips " Dave Hansen
2006-08-29 20:19 ` [RFC][PATCH 09/10] powerpc " Dave Hansen
2006-08-29 20:19 ` [RFC][PATCH 08/10] parisc " Dave Hansen
2006-08-29 20:19 ` [RFC][PATCH 10/10] convert the "easy" architectures to " Dave Hansen
2006-08-29 21:06 ` Luck, Tony
2006-08-29 21:13 ` [RFC][PATCH 10/10] convert the "easy" architectures to generic Dave Hansen
2006-08-30 10:05 ` [RFC][PATCH 10/10] convert the "easy" architectures to generic PAGE_SIZE Paul Mundt
2006-08-30 14:56 ` [RFC][PATCH 10/10] convert the "easy" architectures to generic Dave Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1156956529.12898.10.camel@localhost.localdomain \
--to=haveblue@us.ibm.com \
--cc=linux-ia64@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox