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));
}
}
inline const std::string square_to_string(Square s) {
- std::string str;
- str += file_to_char(square_file(s));
- str += rank_to_char(square_rank(s));
- return str;
+ return std::string(1, file_to_char(square_file(s)))
+ + std::string(1, rank_to_char(square_rank(s)));
}
inline bool file_is_ok(File f) {