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...