RFR: 8183574: Unify the is_power_of_2 functions
Claes Redestad
claes.redestad at oracle.com
Thu Feb 13 15:08:36 UTC 2020
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!
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.
Thanks!
/Claes
More information about the hotspot-dev
mailing list