On Thu, 15 May 2025 15:37:39 GMT, fabioromano1 <[email protected]> wrote:
>> Some changes in `Biginteger`s' bit operations that increase the code
>> readability and slightly optimize the execution time.
>
> fabioromano1 has updated the pull request incrementally with one additional
> commit since the last revision:
>
> make magBitLength() an instance method
src/java.base/share/classes/java/math/BigInteger.java line 3860:
> 3858: && Integer.lowestOneBit(mag[0]) == mag[0]
> 3859: && numberOfTrailingZeroInts() == mag.length - 1
> 3860: ? magBitLength() - 1 : magBitLength();
Suggestion:
int[] mag = this.mag;
return magBitLength()
- (signum < 0
// Check if magnitude is a power of two
&& Integer.lowestOneBit(mag[0]) == mag[0]
&& numberOfTrailingZeroInts() == mag.length - 1
? 1 : 0);
In this way, codeSize will drop from 52 to 45
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25166#discussion_r2092060927