- // intersection with b is zero so when we 'or' the two bitboards togheter
- // and count we get the correct sum of '1' in b and attacked bitboards.
- Bitboard attacked = Us == WHITE ? ((b & pos.pieces_of_color(Them)) >> 1)
- : ((b & pos.pieces_of_color(Them)) << 1);
+ // intersection of the shifted value with b is zero so that after or-ing
+ // the count of 1s bits is increased by the number of affected squares.
+ b |= Us == WHITE ? ((b & pos.pieces_of_color(Them)) >> 1)
+ : ((b & pos.pieces_of_color(Them)) << 1);
+