diff mbox series

m68k: Quiet up cppcheck warning [PR114689]

Message ID Zh09CtlW57Lqf7So@tucnak
State New
Headers show
Series m68k: Quiet up cppcheck warning [PR114689] | expand

Commit Message

Jakub Jelinek April 15, 2024, 2:43 p.m. UTC
Hi!

cppcheck apparently warns on the | !!sticky part of the expression and
using | (!!sticky) quiets it up (it is correct as is).
The following patch adds the ()s, and also adds them around mant >> 1 just
in case it makes it clearer to all readers that the expression is parsed
that way already.

Ok for trunk?

2024-04-15  Jakub Jelinek  <jakub@redhat.com>

	PR libgcc/114689
	* config/m68k/fpgnulib.c (__truncdfsf2): Add parentheses around
	!!sticky bitwise or operand to quiet up cppcheck.  Add parentheses
	around mant >> 1 bitwise or operand.


	Jakub

Comments

Jeff Law April 15, 2024, 2:51 p.m. UTC | #1
On 4/15/24 8:43 AM, Jakub Jelinek wrote:
> Hi!
> 
> cppcheck apparently warns on the | !!sticky part of the expression and
> using | (!!sticky) quiets it up (it is correct as is).
> The following patch adds the ()s, and also adds them around mant >> 1 just
> in case it makes it clearer to all readers that the expression is parsed
> that way already.
> 
> Ok for trunk?
> 
> 2024-04-15  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR libgcc/114689
> 	* config/m68k/fpgnulib.c (__truncdfsf2): Add parentheses around
> 	!!sticky bitwise or operand to quiet up cppcheck.  Add parentheses
> 	around mant >> 1 bitwise or operand.
OK
jeff
diff mbox series

Patch

--- libgcc/config/m68k/fpgnulib.c.jj	2023-11-11 08:52:20.927838065 +0100
+++ libgcc/config/m68k/fpgnulib.c	2024-04-15 16:29:57.810026425 +0200
@@ -302,7 +302,7 @@  __truncdfsf2 (double a1)
   if (exp == EXPDMASK - EXCESSD + EXCESS)
     {
       exp = EXPMASK;
-      mant = mant >> 1 | (mant & 1) | !!sticky;
+      mant = (mant >> 1) | (mant & 1) | (!!sticky);
     }
   else
     {