On Tue, 19 Dec 2023 03:44:26 GMT, Stuart Marks <sma...@openjdk.org> wrote:
>> It looks the `else-if` and `else` clauses in method >> `ArraysSupport::hugeLength` could be simplified by `Math::max`. > > This change would make the code shorter, but in my opinion, it obscures > what's going on. This code tries to be very careful about avoiding problems > caused by integer overflow/wraparound, and in order to do that, it needs to > make sure that the full range of int values is handled properly. With the > explicit if/else code, this is clear. Using Math.max() instead tends to make > this obscure. > > This came up previously; see > > https://github.com/openjdk/jdk/pull/1617#discussion_r536260884 @stuart-marks Thanks for your clarification! Just closed this PR and JBS. ------------- PR Comment: https://git.openjdk.org/jdk/pull/17043#issuecomment-1862076153