RFR: JDK-8277175 : Add a parallel multiply method to BigInteger [v5]

kabutz duke at openjdk.java.net
Wed Dec 15 14:35:00 UTC 2021


On Tue, 30 Nov 2021 23:19:37 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

>> kabutz has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Made forkOrInvoke() method protected to avoid strange compiler error
>
> src/java.base/share/classes/java/math/BigInteger.java line 2000:
> 
>> 1998:         da1 = a2.add(a0);
>> 1999:         db1 = b2.add(b0);
>> 2000:         var vm1_task = RecursiveOp.multiply(da1.subtract(a1), db1.subtract(b1), parallel, depth + 1);
> 
> I recommend incrementing the depth in the `RecursiveOp` constructor, thereby reducing the repetition.

Inside the constructor would not work, since we do not construct RecursiveOp for all the tasks. However, I have incremented the parameter depth. I don't like changing parameters inside methods, but since I'm doing it where it is being used, I feel that the code is now better than before. Thanks for the suggestion.

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

PR: https://git.openjdk.java.net/jdk/pull/6409


More information about the core-libs-dev mailing list