RFR: 8313564: Fix -Wconversion warnings in classfile code [v2]
David Holmes
dholmes at openjdk.org
Wed Aug 2 23:29:00 UTC 2023
On Wed, 2 Aug 2023 19:18:47 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> src/hotspot/share/classfile/symbolTable.cpp line 240:
>>
>>> 238:
>>> 239: double SymbolTable::get_load_factor() {
>>> 240: return (double)_items_count/(double)_current_size;
>>
>> Is this redundant? Both operands are `size_t` so you can cast the result as opposed to both operands.
>
> If I cast the result, I'll lose the remainder. I had to cast current_size because otherwise the compiler complained about it.
Yep an unsigned 64-bit type can't be implicitly converted to double without risking a loss of value
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15111#discussion_r1282500923
More information about the hotspot-dev
mailing list