X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsquare.h;fp=src%2Fsquare.h;h=d35d72bfd5b21311f1b2be9b79d05c597016d76f;hp=aa3585c11d3d80659770899bb324c3dd8b3545fa;hb=9b1d5bd5343540db412c50ae2944246e3f25d18b;hpb=a84e4b20491f69d2b6f64e4f9738fc8ba3394990 diff --git a/src/square.h b/src/square.h index aa3585c1..d35d72bf 100644 --- a/src/square.h +++ b/src/square.h @@ -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)); }