]> git.sesse.net Git - stockfish/blobdiff - src/bitboard.h
Use equations for PushAway and PushClose
[stockfish] / src / bitboard.h
index 440de1ea1ee0be74befddbac703a15d91b900bbf..ca161481c4594e7b191f4fdf5730829b1c4c5bdf 100644 (file)
@@ -129,8 +129,8 @@ constexpr bool more_than_one(Bitboard b) {
   return b & (b - 1);
 }
 
-inline bool opposite_colors(Square s1, Square s2) {
-  return bool(DarkSquares & s1) != bool(DarkSquares & s2);
+constexpr bool opposite_colors(Square s1, Square s2) {
+  return (s1 + rank_of(s1) + s2 + rank_of(s2)) & 1;
 }
 
 
@@ -154,7 +154,7 @@ inline Bitboard file_bb(Square s) {
 }
 
 
-/// shift() moves a bitboard one step along direction D
+/// shift() moves a bitboard one or two steps as specified by the direction D
 
 template<Direction D>
 constexpr Bitboard shift(Bitboard b) {