RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v8]
Raffaello Giulietti
rgiulietti at openjdk.org
Wed Sep 11 15:37:06 UTC 2024
On Wed, 11 Sep 2024 14:23:40 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:
>
> Revision tests changes
test/jdk/java/math/BigInteger/MutableBigIntegerShiftTests.java line 26:
> 24: import jdk.test.lib.RandomFactory;
> 25: import org.junit.jupiter.params.ParameterizedTest;
> 26: import org.junit.jupiter.params.provider.FieldSource;
Unfortunately, the version of JUnit included in the jtreg test harness does not yet have `FieldSource` :-(
Here and below are my suggestions for an alternative.
Suggestion:
import org.junit.jupiter.params.provider.MethodSource;
test/jdk/java/math/BigInteger/MutableBigIntegerShiftTests.java line 50:
> 48: static final int ORDER_SMALL = 60;
> 49: static final int ORDER_MEDIUM = 100;
> 50: static final int[] ORDERS = { ORDER_SMALL, ORDER_MEDIUM };
Suggestion:
private static int[] orders() {
return new int[] { ORDER_SMALL, ORDER_MEDIUM };
}
test/jdk/java/math/BigInteger/MutableBigIntegerShiftTests.java line 55:
> 53:
> 54: @ParameterizedTest
> 55: @FieldSource("ORDERS")
Suggestion:
@MethodSource("orders")
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20008#discussion_r1754980042
PR Review Comment: https://git.openjdk.org/jdk/pull/20008#discussion_r1754980612
PR Review Comment: https://git.openjdk.org/jdk/pull/20008#discussion_r1754980828
More information about the core-libs-dev
mailing list