On Fri, 2 May 2025 17:53:12 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> wrote:
>>> Anyway, since the pre-checks are not precise, that would lead to an >>> implementation with a loop with checked, and another one with unchecked >>> multiplications. I don't think this buys you anything. >> >> It serves to skip the checks in the loop if in the common cases the length >> of the results are way more little with respect to `Long.SIZE` and to fail >> fast if in the common cases the length of the results are way bigger than >> `Long.SIZE`. >> >>> @fabioromano1 Well, there are two checks. In one the product can overflow, >>> you'd need to convert one of the operands to `long`. >> >> If the condition at point 1 is evaluated only if the condition at point 2 is >> false, then it can never overflow. > > If that check would be a couple of instructions or so, then I could agree. > > True, there are no overflows in the checks. @rgiulietti If you think that this checks might be useful, the choice is yours. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25003#discussion_r2071969275