RFR: 8312121: Fix -Wconversion warnings in tribool.hpp

David Holmes dholmes at openjdk.org
Mon Jul 17 03:02:05 UTC 2023


On Sat, 15 Jul 2023 01:30:49 GMT, Dean Long <dlong at openjdk.org> wrote:

>> Assigning _value first, and then doing _value | 2 doesn't get -Wconversion warnings.  Also, reduced include file inclusion a little.
>> Tested with tier1 on linux-x64-debug, windows-x64-debug, macos-aarch64-debug
>
> src/hotspot/share/utilities/tribool.hpp line 44:
> 
>> 42:   TriBool() : _value(0) {}
>> 43:   TriBool(bool value) : _value(value) {
>> 44:     _value = _value | 2;
> 
> You can also do like line 39 and use `(u1)(expr) & 3` or `((expr & 3u)` also seems to work.

Or cast the `2` to `(u1)2` ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14892#discussion_r1264802303


More information about the hotspot-dev mailing list