RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]
Coleen Phillimore
coleenp at openjdk.org
Thu Aug 17 12:37:04 UTC 2023
On Thu, 17 Aug 2023 12:15:24 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> src/hotspot/share/utilities/elfFile.cpp line 792:
>>
>>> 790: // We must align to twice the address size.
>>> 791: uint8_t alignment = DwarfFile::ADDRESS_SIZE * 2;
>>> 792: uint64_t padding = alignment - (_reader.get_position() - _section_start_address) % alignment;
>>
>> 64-bit seems a waste here. I would just cast the result to uint8_t. The % operator ensures it is within range.
>
> Wasting what?
This calls move_position with the value next:
bool DwarfFile::MarkedDwarfFileReader::move_position(const long offset) {
if (offset == 0) {
return true;
}
return set_position(_current_pos + offset);
}
Then set position
bool FileReader::set_position(long offset) {
Both will promote whatever "wasted type" to a long. I probably should make this a long though.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15233#discussion_r1297144614
More information about the build-dev
mailing list