阅读背景:

在Java中移动比特比相乘和分割快吗?net ?

来源:互联网 

Shifting bits left and right is apparently faster than multiplication and division operations on most, maybe even all, CPUs if you happen to be using a power of 2. However, it can reduce the clarity of code for some readers and some algorithms. Is bit-shifting really necessary for performance, or can I expect the compiler or VM to notice the case and optimize it (in particular, when the power-of-2 is a literal)? I am mainly interested in the Java and .NET behavior but welcome insights into other language implementations as well.Shifting bits left and right is apparently fast




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: