From: Brian Haley <Brian.Haley@hp.com>
To: Krishna Kumar <kumarkr@us.ibm.com>
Cc: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>,
davem@davemloft.net, netdev@oss.sgi.com
Subject: Re: [BK PATCH] Misc IPv6 Updates
Date: Wed, 10 Nov 2004 16:18:48 -0500 [thread overview]
Message-ID: <419285B8.4070703@hp.com> (raw)
In-Reply-To: <OF8CA84FB0.6990A5CD-ON88256F48.0063D0E6-88256F48.0064C53C@us.ibm.com>
Krishna Kumar wrote:
> (sorry if my mailer mangles the code)
>
> In :
>
> +static inline int ipv6_addr_equal(const struct in6_addr *a1,
> + const struct in6_addr *a2)
> +{
> + return (a1->s6_addr32[0] == a2->s6_addr32[0] &&
> + a1->s6_addr32[1] == a2->s6_addr32[1] &&
> + a1->s6_addr32[2] == a2->s6_addr32[2] &&
> + a1->s6_addr32[3] == a2->s6_addr32[3]);
> +}
> +
>
> Is it faster to do :
>
> +static inline int ipv6_addr_equal(const struct in6_addr *a1,
> + const struct in6_addr *a2)
> +{
> + return (a1->s6_addr32[3] == a2->s6_addr32[3] &&
> + a1->s6_addr32[2] == a2->s6_addr32[2] &&
> + a1->s6_addr32[1] == a2->s6_addr32[1] &&
> + a1->s6_addr32[0] == a2->s6_addr32[0]);
> +}
> +
>
> instead ?It should be faster for typical addresses, say 2000:a:b:c::1
> and 2000:a:b:c::2. The device EUI-64 is
> normally going to be different for all devices while prefix can be same
> (atleast on a link/local site) completely
> or to some prefix len portion.
I think it might be fastest to do 3-0-2-1 as that will more quickly tell
a global from a link-local address.
I will eventually do a 64-bit comparison to see if putting an
#ifdef CONFIG_64BIT is worth it.
-Brian
next prev parent reply other threads:[~2004-11-10 21:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-10 8:00 [BK PATCH] Misc IPv6 Updates YOSHIFUJI Hideaki / 吉藤英明
2004-11-10 18:20 ` Krishna Kumar
2004-11-10 21:18 ` Brian Haley [this message]
2004-11-10 21:23 ` YOSHIFUJI Hideaki / 吉藤英明
2004-11-10 21:25 ` YOSHIFUJI Hideaki / 吉藤英明
2004-11-11 23:18 ` David S. Miller
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=419285B8.4070703@hp.com \
--to=brian.haley@hp.com \
--cc=davem@davemloft.net \
--cc=kumarkr@us.ibm.com \
--cc=netdev@oss.sgi.com \
--cc=yoshfuji@linux-ipv6.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).