Does the Java compiler or the JIT compiler optimize divisions or multiplications by a constant power of two down to bitshifting?
For example, are the following two statements optimized to be the same?
int median = start + (end - start) >>> 1;
int median = start + (end - start) / 2;
(basically this question but for Java)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…