Re: [hatari-devel] Strange code in softfloat.c (was: patch: Add some missing include directives) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
> After updating my system to Fedora 32, I now get the same warnings
> with Clang version 10:
>
> src/cpu/softfloat/softfloat.c:181:22: warning: bitwise negation of a boolean expression; did you mean logical negation? [-Wbool-operation]
> zSig0 &= ~ ( ( (uint64_t) ( zSig1<<1 ) == 0 ) & ( status->float_rounding_mode == float_round_nearest_even ) );
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> !
> src/cpu/softfloat/softfloat.c:300:22: warning: bitwise negation of a boolean expression; did you mean logical negation? [-Wbool-operation]
> zSig0 &= ~ ( ( (uint64_t) ( zSig1<<1 ) == 0 ) & ( floatx80_internal_mode == float_round_nearest_even ) );
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> !
> 2 warnings generated.
> [ 61%] Building C object src/cpu/CMakeFiles/UaeCpu.dir/softfloat/softfloat_decimal.c.o
> src/cpu/softfloat/softfloat_decimal.c:58:13: warning: bitwise negation of a boolean expression; did you mean logical negation? [-Wbool-operation]
> zSig0 &= ~ (((uint64_t) (zSig1<<1) == 0) & (status->float_rounding_mode == float_round_nearest_even));
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> !
> 1 warning generated.
>
> Toni, any ideas whether this could maybe be done in a different way?
What about something simple (and much more readable) like this:
if ((zSig1 << 1) == 0 && status->float_rounding_mode ==
float_round_nearest_even)
zSig0 &= ~1;