From: Joe Perches <joe@perches.com>
To: Zhang Shengju <zhangshengju@cmss.chinamobile.com>,
sathya.perla@broadcom.com, ajit.khaparde@broadcom.com,
sriharsha.basavapatna@broadcom.com, netdev@vger.kernel.org
Subject: Re: [net-next] be2net: use shift instead of expensive divide
Date: Mon, 28 Aug 2017 20:44:02 -0700 [thread overview]
Message-ID: <1503978242.2040.16.camel@perches.com> (raw)
In-Reply-To: <1503976719-3063-1-git-send-email-zhangshengju@cmss.chinamobile.com>
On Tue, 2017-08-29 at 11:18 +0800, Zhang Shengju wrote:
> Replace shift instead of expensive divide.
This change is mostly pointless.
Any half-way decent compiler should produce the same object.
gcc emits the same object with the old code.
The AMAP_GET_BITS macro uses the "offsetof(struct, member) / 32"
style too.
> diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
[]
> @@ -2455,7 +2455,7 @@ static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo)
>
> /* For checking the valid bit it is Ok to use either definition as the
> * valid bit is at the same position in both v0 and v1 Rx compl */
> - if (compl->dw[offsetof(struct amap_eth_rx_compl_v1, valid) / 32] == 0)
> + if (compl->dw[offsetof(struct amap_eth_rx_compl_v1, valid) >> 5] == 0)
etc...
next prev parent reply other threads:[~2017-08-29 3:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 3:18 [net-next] be2net: use shift instead of expensive divide Zhang Shengju
2017-08-29 3:44 ` Joe Perches [this message]
2017-08-29 4:25 ` David 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=1503978242.2040.16.camel@perches.com \
--to=joe@perches.com \
--cc=ajit.khaparde@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=sathya.perla@broadcom.com \
--cc=sriharsha.basavapatna@broadcom.com \
--cc=zhangshengju@cmss.chinamobile.com \
/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.