On Tue, 29 Mar 2022 15:56:37 GMT, Jim Laskey <jlas...@openjdk.org> wrote:

>> doesn't the compiler (either javac or hotspot) automatically do that?
>
> Yes, the compilers handle this.  I did however switch to 
> 
> 
>                     primitiveCount != 0 ? new long[(primitiveCount + 1) / 
> LONG_SLOTS] : null;

> doesn't the compiler (either javac or hotspot) automatically do that?

Only for multiplication, because `-1 >> 1 == -1`, `-1 >>> 1 == 
Integer.MAX_VALUE`, and `-1 / 2 == 0`.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7744

Reply via email to