RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v9]
fabioromano1
duke at openjdk.org
Thu Sep 12 11:09:06 UTC 2024
On Thu, 12 Sep 2024 10:27:39 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:
>> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Use supported annotation by jtreg in tests
>
> src/java.base/share/classes/java/math/MutableBigInteger.java line 753:
>
>> 751: * {@code (resPos <= offset || resPos >= offset + intLen)}.
>> 752: */
>> 753: private final void primitiveLeftShift(int n, int[] result, int resPos) {
>
> I think this method can be made more symmetrical w.r.t. `primitiveRightShift()` if starting from the right (least significant `int`).
Yes, it could, but the problem is that in this way the precondition `(resPos <= offset || resPos >= offset + intLen)` is no longer correct, and in particular `resPos <= offset` is used by `MBI.leftShift()` if `result == value`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20008#discussion_r1756641412
More information about the core-libs-dev
mailing list