2014-09-30 14:38, Xie, Huawei: > > - if (++next >= MEMNIC_NR_PACKET) > > + if (unlikely(++next >= MEMNIC_NR_PACKET)) > > On IA, compiler can use add, cmp and cmov to avoid branch. > But If MEMNIC_NR_PACKET is always power of 2, > it is better just next = (next + 1) & (MEMNIC_NR_PACKET - 1)
Power of 2 is not enforced for MEMNIC_NR_PACKET. -- Thomas