public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: David Miller <davem@davemloft.net>
Cc: rdreier@cisco.com, akpm@osdl.org, linux-kernel@vger.kernel.org,
	openib-general@openib.org, tom@opengridcomputing.com
Subject: Re: [PATCH] Avoid truncating to 'long' in ALIGN() macro
Date: Sun, 26 Nov 2006 01:10:14 +0000	[thread overview]
Message-ID: <20061126011014.GR3078@ftp.linux.org.uk> (raw)
In-Reply-To: <20061125.150500.14841768.davem@davemloft.net>

On Sat, Nov 25, 2006 at 03:05:00PM -0800, David Miller wrote:
> From: Roland Dreier <rdreier@cisco.com>
> Date: Sat, 25 Nov 2006 14:56:22 -0800
> 
> >  > Perhaps a better way to fix this is to use
> >  > typeof() like other similar macros do.
> > 
> > I tried doing
> > 
> > #define ALIGN(x,a)				\
> > 	({					\
> > 		typeof(x) _a = (a);		\
> > 		((x) + _a - 1) & ~(_a - 1);	\
> > 	})
> > 
> > but that won't compile because of <net/neighbour.h>:
> 
> You would need to also cast the constants with typeof() to.

Oh, for fsck sake...

	(typeof(x))((x + a - 1) & ~(a - 1ULL))

  parent reply	other threads:[~2006-11-26  1:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-25  5:40 [PATCH] Avoid truncating to 'long' in ALIGN() macro Roland Dreier
2006-11-25  6:07 ` David Miller
2006-11-25 22:56   ` Roland Dreier
2006-11-25 23:05     ` David Miller
2006-11-25 23:09       ` Roland Dreier
2006-11-26  0:41         ` Andrew Morton
2006-11-26 19:09           ` Roland Dreier
2006-11-26 19:10           ` Roland Dreier
2006-11-26 19:17             ` Andrew Morton
2006-11-26 20:06               ` Roland Dreier
2006-11-26 20:11               ` Linus Torvalds
2006-11-26 20:26                 ` Roland Dreier
2006-11-26 21:06                   ` Jörn Engel
2006-11-26 22:20                   ` Linus Torvalds
2006-11-27  4:41                     ` Al Viro
2006-11-26  1:10       ` Al Viro [this message]
2006-11-26  1:17         ` Roland Dreier
2006-11-26  1:25           ` Al Viro

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=20061126011014.GR3078@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=akpm@osdl.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openib-general@openib.org \
    --cc=rdreier@cisco.com \
    --cc=tom@opengridcomputing.com \
    /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