Skip to content

Commit 0fe9e77

Browse files
Seija KijinAZero13
authored andcommitted
git: use logical-not operator to toggle between 0 and 1
If it is known that an int is either 1 or 0, using a logical-not to switch instead of a modulus makes more sense and is more efficient. Signed-off-by: Seija Kijin <[email protected]>
1 parent d882f38 commit 0fe9e77

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ static void mark_color_as_moved(struct diff_options *o,
12311231
&pmb_nr);
12321232

12331233
if (contiguous && pmb_nr && moved_symbol == l->s)
1234-
flipped_block = (flipped_block + 1) % 2;
1234+
flipped_block = !flipped_block;
12351235
else
12361236
flipped_block = 0;
12371237

0 commit comments

Comments
 (0)