Hi,
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++;
i &= (ringbufferlength - 1)
So we can get along without the if.
Jan-Bernd
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]