RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v14]

Raffaello Giulietti rgiulietti at openjdk.org
Tue Oct 1 09:07:40 UTC 2024


On Sat, 28 Sep 2024 07:30:18 GMT, fabioromano1 <duke at openjdk.org> wrote:

>> This implementation of MutableBigInteger.leftShift(int) optimizes the current version, avoiding unnecessary copy of the MutableBigInteger's value content and performing the primitive shifting only in the original portion of the value array rather than in the value yet extended with trailing zeros.
>
> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Small correction to ensure n > leadingZeros && nBits > leadingZeros

test/jdk/java/math/BigInteger/MutableBigIntegerShiftTests.java line 115:

> 113:             leftShiftAssertions(x, n);
> 114:         }
> 115:     }

I think this can be made `@ParameterizedTest` by refactoring `cases` into a method?

Otherwise looks good.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20008#discussion_r1782407656


More information about the core-libs-dev mailing list