Skip to content

Commit fefc0c6

Browse files
protonspringStéphane Nicolet
authored andcommitted
simplify opposite_colors
1 parent 5c2fbcd commit fefc0c6

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/bitboard.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ constexpr bool more_than_one(Bitboard b) {
135135
return b & (b - 1);
136136
}
137137

138+
inline bool opposite_colors(Square s1, Square s2) {
139+
return bool(DarkSquares & s1) != bool(DarkSquares & s2);
140+
}
141+
138142
/// rank_bb() and file_bb() return a bitboard representing all the squares on
139143
/// the given file or rank.
140144

src/types.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,6 @@ constexpr Rank relative_rank(Color c, Square s) {
413413
return relative_rank(c, rank_of(s));
414414
}
415415

416-
inline bool opposite_colors(Square s1, Square s2) {
417-
int s = int(s1) ^ int(s2);
418-
return ((s >> 3) ^ s) & 1;
419-
}
420-
421416
constexpr Direction pawn_push(Color c) {
422417
return c == WHITE ? NORTH : SOUTH;
423418
}

0 commit comments

Comments
 (0)