Use opposite_color_squares() instead of same_color_squares()

It is almost alwasy the requested test and is a bit faster too.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2011-01-19 13:43:07 +01:00
parent 4f3fe89fb6
commit 324ca87aff
3 changed files with 13 additions and 35 deletions

View File

@@ -107,9 +107,9 @@ inline SquareColor square_color(Square s) {
return SquareColor((int(square_file(s)) + int(square_rank(s))) & 1);
}
inline bool same_color_squares(Square s1, Square s2) {
inline bool opposite_color_squares(Square s1, Square s2) {
int s = int(s1) ^ int(s2);
return (((s >> 3) ^ s) & 1) == 0;
return ((s >> 3) ^ s) & 1;
}
inline int file_distance(File f1, File f2) {