| 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
] 
- To: Toni Wilen <twilen@xxxxxxxxxx>
- Subject: Re: [hatari-devel] Strange code in softfloat.c (was: patch: Add some missing include directives)
- From: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Mon, 4 May 2020 04:09:00 +0200
- Cc: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017;	t=1588558143; bh=RZATMtUmK38UC8IrQwPaJlgjFDPswpoxcGoA+1WNNd8=;	h=Date:From:To:Cc:Subject:From;	b=GLbmz0HISKUhEbnp9N340r6pi9nUqpdzS68+xyvdYIOYXo37FAPjRUKL4eA6UFGT7	 K7MT3so8AwN710LrMjvhf4wX5bRMF6zwo/2yV45t8/LyhbWzunDZZj/OnDWpQ/IPXB	 PqnTvsN3PsIXKFlvBiZ/E12tADSF0U39W85jqheCW7jwIZ3LVG0gAyfvg56ST2U+0U	 U75cQI7j9JfnnUV4qo/JL61ht6xydCO8LgsjR5DsXdogmuBhMNqzdmoeMuApGXpSz6	 XiGmIphCn42GLj3ZeOBpHN0c5OxUs4czzcpkHNqQP6uy0HhVdw46EaPvNycgX0vOKB	 ogKabuwURkXnA==
Am Sun, 3 May 2020 18:29:00 +0300
schrieb Toni Wilen <twilen@xxxxxxxxxx>:
> > 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;
Yes, that looks easier to read, indeed, and should silence the compiler
warning. Thanks!
 Thomas