qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs


From: BALATON Zoltan
Subject: Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs
Date: Tue, 9 May 2017 11:55:36 +0200 (CEST)
User-agent: Alpine 2.20 (BSF 67 2015-01-07)

On Tue, 9 May 2017, Aurelien Jarno wrote:
| main.c: In function 'print_fpscr_settings':
| main.c:73:26: warning: suggest parentheses around comparison in operand of 
'&' [-Wparentheses]
|          if ((fpscr >> i) & 0x1 == 1) {
|                           ^

Actually the compiler is correct here, this should be:

if ((fpscr >> i & 0x1) == 1) {

or even just

if (fpscr >> i & 1) {

because & is lower priority than == but the result may still be the same by chance if 0x1 == 1 is always 1 and ANDing the shifted value with this is either 0 or 1 so it may give the correct result but not the way one would think looking at the expression.

Regards,
BALATON Zoltan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]