On Fri, 16 May 2025 11:10:12 GMT, fabioromano1 <d...@openjdk.org> 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:
> 
>   An optimization

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

> 5032:      */
> 5033:     private byte[] magSerializedForm() {
> 5034:         byte[] result = new byte[(magBitLength() + 7) >>> 3];

I think there's a risk of overflow, so consider
Suggestion:

        byte[] result = new byte[(magBitLength() - 1 >>> 3) + 1];

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

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

Reply via email to