On Fri, 3 Mar 2023 22:48:23 GMT, Paul Sandoz <psan...@openjdk.org> wrote:

>> Adam Sotona has updated the pull request incrementally with three additional 
>> commits since the last revision:
>> 
>>  - fixed AccessFlags javadoc
>>  - TransformImpl.FakeXyzTransform renamed to UnresolvedXyzTransform
>>  - removed obsolete generic parameter from AbstractDirectBuilder
>
> src/java.base/share/classes/jdk/internal/classfile/impl/EntryMap.java line 
> 176:
> 
>> 174:     }
>> 175: 
>> 176:     public static long nextPowerOfTwo( long x ) {
> 
> If you like you can change the implementation to be:
> 
> x = -1 >>> Long.numberOfLeadingZeros(x - 1);
> return x + 1;
> 
> See `ConcurrentHashMap`.

`Long:numberOfLeadingZeros` implementation uses more method calls, conditional 
statements and binary operations. I would prefer to stick with the current 
implementation for its speed and simplicity.

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

PR: https://git.openjdk.org/jdk/pull/10982

Reply via email to