RFR: 8303418: Improve parameter and variable names in BitMap [v2]

Axel Boldt-Christmas aboldtch at openjdk.org
Thu Mar 2 07:45:13 UTC 2023


On Wed, 1 Mar 2023 06:08:33 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Please review this change to names in BitMap.
>> 
>> - Parameters that designate a bit in a BitMap are named "bit".
>> - Parameters that designate a word in the underlying BitMap storage are named "word".
>> - Parameters that designate a range are named "beg" and "end" resp.
>> 
>> Added helper function `flipped_word` for use by `get_next_bit_impl`, replacing
>> the odd overload for `map`.
>> 
>> In `get_next_bit_impl`, prefixed the variables "index" and "limit" with
>> "word_" to make clear the units.
>> 
>> Testing:
>> mach5 tier1
>
> Kim Barrett has updated the pull request incrementally with one additional commit since the last revision:
> 
>   copyrights

Nice to see a _bit_ more consistency in the parameter names here.

Not 100% sold on the use of `bit` for a single bit index. But at least consistency makes it clearer. 

As long as `beg` and `end` are used for `[beg,end)` ranges then the names are appropriate. If they ever start to deviate from the `std::begin` and `std::end` semantics they should be changed to avoid confusion.

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

Marked as reviewed by aboldtch (Committer).

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


More information about the hotspot-dev mailing list