Skip to content

Commit

Permalink
Use one more bitwise op
Browse files Browse the repository at this point in the history
Signed-off-by: Engin Kayraklioglu <[email protected]>
  • Loading branch information
e-kayrakli committed Jan 15, 2023
1 parent 36ce2dc commit 133a4e8
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ module queens_GPU_call_device_search{
var safe = true;
const base = board[r];
for (i, rev_i, offset) in zip(0..<r, 0..<r by -1, 1..r) {
safe &= !((board[i] == base) || (board[rev_i] == base-offset ||
board[rev_i] == base+offset));
// why can't I use bitwise OR for the second case?
safe &= !((board[i] == base) | (board[rev_i] == base-offset ||
board[rev_i] == base+offset));
}
return safe;
}
Expand Down

0 comments on commit 133a4e8

Please sign in to comment.