RFR: 8343700: ceil_log2 should not loop endlessly [v2]
Aleksey Shipilev
shade at openjdk.org
Wed Nov 13 18:39:00 UTC 2024
On Wed, 13 Nov 2024 18:29:04 GMT, Sonia Zaldana Calles <szaldana at openjdk.org> wrote:
>> Hi all,
>>
>> This PR addresses [8343700](https://bugs.openjdk.org/browse/JDK-8343700) where ceil_log2 looped endlessly if the input value has the highest bit set.
>>
>> I also dealt with the case where we try to find ceil_log2(1) which would've returned 1 as opposed to 0.
>>
>> Cheers,
>> Sonia
>
> Sonia Zaldana Calles has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>
> - Merge branch 'openjdk:master' into JDK-8343700
> - 8343700: ceil_log2 should not loop endlessly
src/hotspot/share/utilities/powerOfTwo.hpp line 127:
> 125: inline T ceil_log2(T value) {
> 126: assert(value > 0, "Invalid value");
> 127: if (value == 1) return 0;
Is this the same as starting the loop from `ret = 0`?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22074#discussion_r1840980246
More information about the hotspot-dev
mailing list