Re: [RFC-UGLYPATCH] ata: small optimization in linux/libata.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 14 Feb 2008 11:16:18 -0800
Harvey Harrison <harvey.harrison@xxxxxxxxx> 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

-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux