On Fri, 18 Jul 2025 17:54:11 GMT, Ambarish Rapte <ara...@openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/prism/mtl/MTLResourceFactory.java
>>  line 75:
>> 
>>> 73:             i *= 2;
>>> 74:         }
>>> 75:         return i;
>> 
>> interesting...  would `1 << val` be simpler (barring overflow)?
>
> Changed accordingly and included another check to verify if the `val` is 
> already a power of two.

This code (in my experience) is easy to get wrong.
Could we add some tests, to verify that
- values within the allowed range (small and large) work as expected
- values outside of the allowed range fail as expected
- power of 2 values are returned unchanged

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1824#discussion_r2216627398

Reply via email to