[PATCH 1/6] ehea: interface to network stack

Jan-Bernd Themann ossthema at de.ibm.com
Tue Aug 15 01:43:21 EST 2006


Anton Blanchard wrote:
>> Is a conditional cheaper than a divide?  In case of a misprediction I
>> would assume it to be significantly slower and I don't know the ratio
>> of mispredictions for this branch.
> A quick scan of the web shows 40 cycles for athlon64 idiv, and its
> similarly slow on many other cpus. Even assuming you mispredict every
> branch its going to be a win.
> Anton

as our queue size is always a power of 2, we simply use:
i &= (ringbufferlength - 1)

So we can get along without the if.


More information about the Linuxppc-dev mailing list