RFR: 8183574: Unify the is_power_of_2 functions
Stefan Karlsson
stefan.karlsson at oracle.com
Thu Feb 13 15:55:04 UTC 2020
On 2020-02-13 16:08, Claes Redestad wrote:
> On 2020-02-13 15:47, Stefan Karlsson wrote:
>> Hi all,
>>
>> Please review this patch to consolidate all is_power_of_2 functions
>> into one template function and place it in the existing
>> powerOfTwo.hpp file.
>>
>> To resolve a circular dependency between globalDefinitions.hpp and
>> powerOfTwo.hpp, I also moved exact_log2 and exact_log2_long. These
>> functions take a power-of-two value and returns the log2 value, so I
>> think it makes sense to move them to powerOfTwo.hpp.
>>
>> https://cr.openjdk.java.net/~stefank/8183574/webrev.01
>
> Looks good!
Thanks!
>
> It seems exact_log2 and exact_log2_long could also be replaced by a
> single template function, but that might be better suited as a follow-
> up.
Right. The format specifier needs to be different depending on parameter
type, so I skipped trying to unify them for now.
StefanK
> Thanks!
>
> /Claes
More information about the hotspot-dev
mailing list