RFR: 8267332: xor value should handle bounded values [v3]
Nils Eliasson
neliasso at openjdk.java.net
Fri May 21 09:27:33 UTC 2021
On Thu, 20 May 2021 22:01:09 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> Right, that's why I widened to an `uint` (since `next_power_of_2((uint)jint::max())` is well-defined) then cast back to a `jint` after subtracting 1.
>
> Another way of expressing the same in an overflow-conscious way (without type conversion) is `round_down_power_of_2(t1i->_hi) + (round_down_power_of_2(t1i->_hi) - 1)`
I agree - that is a much better solution! Thanks Claes!
-------------
PR: https://git.openjdk.java.net/jdk/pull/4136
More information about the hotspot-compiler-dev
mailing list