Skip to content

Commit

Permalink
Fix operator precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
maneatingape committed Jan 2, 2025
1 parent 8991a07 commit d6c71d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/year2016/day18.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn count(input: &str, rows: u32) -> u32 {
// Count the traps in each row.
total += row.count_ones();
// Only consider the left and right values for the next row.
row = (row << 1) ^ (row >> 1) & mask;
row = ((row << 1) ^ (row >> 1)) & mask;
}

// We want the number of safe tiles so convert from the number of traps.
Expand Down

0 comments on commit d6c71d4

Please sign in to comment.