On Fri, 6 Jun 2025 19:22:10 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:
>> Radim Vansa has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Add more comments >> - Disable search table with dynamic CDS > > src/hotspot/share/utilities/packedTable.cpp line 83: > >> 81: assert(mid >= low && mid < high, "integer overflow?"); >> 82: uint64_t element = read_element(data, length, _element_bytes * mid); >> 83: uint32_t key = element & _key_mask; > > All this casting is hard to follow so I added this at the beginning of the > file: > > #ifndef _WIN32 > #pragma GCC diagnostic warning "-Wconversion" > #endif > > and this line, 102, and 87 complain: > > > warning: conversion from 'uint64_t' {aka 'long unsigned int'} to 'uint32_t' > {aka 'unsigned int'} may change value [-Wconversion] > 87 | uint32_t key = element & _key_mask; > | ~~~~~~~~^~~~~~~~~~~ > > > If the value is okay to cast to uint32_t, which I believe it is, use > checked_cast<uint32_t> from checkedCast.hpp. We cannot use `checked_cast`, because `element` can contain higher-order bits; but we want to ignore those. I can do an explicit `static_cast` and add a comment. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24847#discussion_r2135343070