linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christer Weinigel <christer@weinigel.se>
To: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Jeff Garzik <jeff@garzik.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-ide <linux-ide@vger.kernel.org>
Subject: Re: [RFC-UGLYPATCH] ata: small optimization in linux/libata.h
Date: Fri, 15 Feb 2008 22:32:50 +0100	[thread overview]
Message-ID: <20080215223250.0f229dbe@weinigel.se> (raw)
In-Reply-To: <1203016578.2748.69.camel@brick>

On Thu, 14 Feb 2008 11:16:18 -0800
Harvey Harrison <harvey.harrison@gmail.com> wrote:

> Original:
> 	if (++link - ap->pmp_link < ap->nr_pmp_links)
> Next:
> 	if ((char*)++link - (char *)ap->pmp_link < ap->nr_pmp_links * sizeof(*link)) return link;

Ungh. 

Why not rewrite it as (untested):

    if (++link < ap->pmp_link + ap->nr_pmp_links)

That should be just as efficient and more readable since it
is a simple if (ptr < start + size).

  /Christer


  parent reply	other threads:[~2008-02-15 21:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-14 19:16 [RFC-UGLYPATCH] ata: small optimization in linux/libata.h Harvey Harrison
2008-02-14 23:39 ` Tejun Heo
2008-02-15  0:05   ` Harvey Harrison
2008-02-15  1:58     ` Tejun Heo
2008-02-15  8:56       ` Mikael Pettersson
2008-02-15 16:10 ` Jeff Garzik
2008-02-15 21:32 ` Christer Weinigel [this message]
2008-02-15 21:41   ` [PATCH] ata: fix sparse warning in libata.h Harvey Harrison
2008-02-15 22:18     ` Tejun Heo
2008-02-20 17:12     ` Jeff Garzik

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=20080215223250.0f229dbe@weinigel.se \
    --to=christer@weinigel.se \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=harvey.harrison@gmail.com \
    --cc=jeff@garzik.org \
    --cc=linux-ide@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;
as well as URLs for NNTP newsgroup(s).