On Mon, 12 May 2025 01:46:25 GMT, David Schlosnagle <[email protected]> wrote:
>> Some changes in `Biginteger`s' bit operations that increase the code
>> readability and slightly optimize the execution time.
>
> src/java.base/share/classes/java/math/BigInteger.java line 2642:
>
>> 2640: }
>> 2641: // (this.abs().bitLength() - 1L) * exponent + 1L >
>> Integer.MAX_VALUE
>> 2642: if (scaleFactor + bitsToShift - exponent >= Integer.MAX_VALUE)
>> {
>
> If this is overflow sensitive code, should this avoid adding on the left hand
> side?
>
> Suggestion:
>
> if (scaleFactor - exponent >= Integer.MAX_VALUE - bitsToShift) {
I think we are fine here, `scaleFactor` is already `long`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25166#discussion_r2083704486