From 51716898aa00ea2d38dfe38d28a33b4ffbdf22ff Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Sun, 13 Mar 2022 22:03:29 +0100 Subject: [PATCH] Twos: fix warning about extra paranthesis We have a comparison like `if (( a == b ))`, which is a parenthesis too much, which generates the following warning ``` InfiniTime/src/displayapp/screens/Twos.cpp:133:35: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] if ((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ InfiniTime/src/displayapp/screens/Twos.cpp:133:35: note: remove extraneous parentheses around the comparison to silence this warning if ((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) { ~ ^ ~ ``` --- src/displayapp/screens/Twos.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/displayapp/screens/Twos.cpp b/src/displayapp/screens/Twos.cpp index b15332f1..6d675859 100644 --- a/src/displayapp/screens/Twos.cpp +++ b/src/displayapp/screens/Twos.cpp @@ -130,7 +130,7 @@ bool Twos::placeNewTile() { } bool Twos::tryMerge(TwosTile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol) { - if ((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) { + if (grid[newRow][newCol].value == grid[oldRow][oldCol].value) { if ((newCol != oldCol) || (newRow != oldRow)) { if (!grid[newRow][newCol].merged) { unsigned int newVal = grid[oldRow][oldCol].value *= 2;