[Top] [All Lists]

Re: [INET] Optimise away a branch in IP_ECN_set_ce

To: "YOSHIFUJI Hideaki / ?$B5HF#1QL@" <yoshfuji@xxxxxxxxxxxxxx>
Subject: Re: [INET] Optimise away a branch in IP_ECN_set_ce
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 9 Sep 2004 11:54:42 +1000
Cc: davem@xxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20040909.102736.94408944.yoshfuji@xxxxxxxxxxxxxx>
References: <20040909000330.GA5581@xxxxxxxxxxxxxxxxxxx> <20040909.092428.125540781.yoshfuji@xxxxxxxxxxxxxx> <20040909011016.GA9238@xxxxxxxxxxxxxxxxxxx> <20040909.102736.94408944.yoshfuji@xxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.6+20040722i
On Thu, Sep 09, 2004 at 10:27:36AM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:
> > > And, I think 
> > >   u16 ecn = (iph->tos + 1) & INET_ECN_MASK;
> > >   check += (u32)htons(0xfffb) + (u32)htons(ecn);
> > 
> > The second htons is less optimal than the shift because htons doesn't
> > know that ecn is only a byte.  So it'll end up doing a full swap.
> Not true; gcc is clever enough to produces same code, and my code looks 
> better.

Sorry, you're right.  Here is an updated patch.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

Visit Openswan at
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page:
PGP Key:

Attachment: p
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>