mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-23 18:46:59 +08:00
Introduce and use same_color_squares()
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -139,6 +139,11 @@ inline Color square_color(Square s) {
|
||||
return Color((int(square_file(s)) + int(square_rank(s))) & 1);
|
||||
}
|
||||
|
||||
inline bool same_color_squares(Square s1, Square s2) {
|
||||
int s = int(s1) ^ int(s2);
|
||||
return (((s >> 3) ^ s) & 1) == 0;
|
||||
}
|
||||
|
||||
inline int file_distance(File f1, File f2) {
|
||||
return abs(int(f1) - int(f2));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user