RFR: 8294982: Implementation of Classfile API [v43]
Adam Sotona
asotona at openjdk.org
Tue Mar 7 14:39:09 UTC 2023
On Fri, 3 Mar 2023 22:48:23 GMT, Paul Sandoz <psandoz at 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
More information about the core-libs-dev
mailing list