All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Jiri Kosina <trivial@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] treewide: Add and use ADD_MOD macro
Date: Mon, 29 Mar 2010 13:00:42 -0700	[thread overview]
Message-ID: <1269892842.4558.7.camel@Joe-Laptop.home> (raw)
In-Reply-To: <20100329124708.898b617c.randy.dunlap@oracle.com>

On Mon, 2010-03-29 at 12:47 -0700, Randy Dunlap wrote:
> On Sun, 28 Mar 2010 14:57:27 -0700 Joe Perches wrote:
> > Add a macro for the somewhat common use of
> > 	(something + value) % value
> > because the test uses ADD_MOD
> > --- a/include/linux/kernel.h
> > +++ b/include/linux/kernel.h
> > +#define ADD_MOD(x, y) (((x) + (y)) % (y))
> It would be better not to evaluate y more than one time.

That could be said for nearly all the convenience
macros in kernel.h

> Also it's not safe for 64-bit 'y' on i386, right?
> Looks like it would cause missing reference to __imoddi3
> or whatever it is called.

Which is also true for nearly all the convenience
macros in kernel.h

> so it can easily be misused IMO.

etc.


  reply	other threads:[~2010-03-29 20:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-28 21:57 [PATCH] treewide: Add and use ADD_MOD macro Joe Perches
2010-03-29 19:47 ` Randy Dunlap
2010-03-29 20:00   ` Joe Perches [this message]
2010-03-29 21:09     ` [PATCH] kernel.h: Convert rounding macros to statement expressions, add ADD_MOD Joe Perches
2010-03-29 21:49       ` Randy Dunlap
2010-03-29 22:18         ` [PATCH V2] " Joe Perches
2010-04-05 22:12           ` Andrew Morton

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=1269892842.4558.7.camel@Joe-Laptop.home \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=trivial@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.