chiark / gitweb /
Clarify conditions to avoid compiler errors
authorKhem Raj <raj.khem@gmail.com>
Tue, 6 Dec 2016 01:22:00 +0000 (01:22 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 6 Dec 2016 21:40:24 +0000 (21:40 +0000)
Fix errors pointed out by clang

error: logical not is only applied to the left hand side of this bitwise operator [-Werror,-Wlogical-not-parentheses]
|         if (only_immutable && !copy->flags[i] & FLAG_IMMUTABLE) continue;
|                               ^

Signed-off-by: Khem Raj <raj.khem@gmail.com>
signpost.c
tracks.c

index aa2e13af9abfa65ce51c0b663aead1a3cb32825d..2e2dff227503c51b37e290bc9c73522276a3bf96 100644 (file)
@@ -284,7 +284,7 @@ static int check_nums(game_state *orig, game_state *copy, int only_immutable)
     int i, ret = 1;
     assert(copy->n == orig->n);
     for (i = 0; i < copy->n; i++) {
-        if (only_immutable && !copy->flags[i] & FLAG_IMMUTABLE) continue;
+        if (only_immutable && !(copy->flags[i] & FLAG_IMMUTABLE)) continue;
         assert(copy->nums[i] >= 0);
         assert(copy->nums[i] <= copy->n);
         if (copy->nums[i] != orig->nums[i]) {
index 5b273508bb6faf4573262dcc3149a80066f0360c..ca44ce1c3e3e39d8fafd1cdbdfeebb3bdce3db78 100644 (file)
--- a/tracks.c
+++ b/tracks.c
@@ -1072,7 +1072,7 @@ static int solve_check_single_sub(game_state *state, int si, int id, int n,
         x = i%w;
         y = i/w;
         if (abs(ox-x) > 1 || abs(oy-y) > 1) {
-            if (!state->sflags[i] & S_TRACK)
+            if (!(state->sflags[i] & S_TRACK))
                 did += solve_set_sflag(state, x, y, S_NOTRACK, what);
         }
     }