RFR: 8292022: Issues caused by Unary Plus Operator + and Shift Operators priority

Aleksey Shipilev shade at openjdk.org
Fri Aug 19 13:23:33 UTC 2022


On Mon, 1 Aug 2022 07:07:18 GMT, GGGGGHT <duke at openjdk.org> wrote:

> (capacity + capacity>>1) The result of this expression is still capacity. So I guess what the author thought at the time might be (capacity + (capacity >> 1)), see https://bugs.openjdk.org/projects/JDK/issues/JDK-8292022

I don't see a reason to over-allocate the 1.5x sized ByteBuffer here. So, if we just drop to ` `ByteBuffer.allocate(capacity)`, it would still resolve the problem, leave the current behavior as it is (obviates the need for deeper testing), and would make more sense anyway. Right?

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

PR: https://git.openjdk.org/jdk/pull/9698


More information about the compiler-dev mailing list