On Sat, 10 May 2025 16:41:17 GMT, fabioromano1 <d...@openjdk.org> wrote:

> Some changes in `Biginteger`s' bit operations that increase the code 
> readability and slightly optimize the execution time.

src/java.base/share/classes/java/math/BigInteger.java line 2828:

> 2826:      * assuming there are no leading zero ints.
> 2827:      */
> 2828:     private static int bitLength(int[] val, int len) {

This should really be refactored to an instance method `bitLengthUnsigned` or 
`magBitCount`: the `len` is always `val.length` and the `val` is always the 
`mag` array of some `BigInteger` from somewhere. Making this an instance method 
makes code cleaner and allows us to cache if we find this calculation expensive.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25166#discussion_r2083561722

Reply via email to