Simplify squares_aligned()
authorMarco Costalba <mcostalba@gmail.com>
Sun, 10 Nov 2013 11:00:15 +0000 (12:00 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 10 Nov 2013 11:05:19 +0000 (12:05 +0100)
Use newly introduced LineBB[]

No functional change.

src/bitboard.cpp
src/bitboard.h

index 7687cbb..3683b36 100644 (file)
@@ -227,8 +227,8 @@ void Bitboards::init() {
               for (Square s = s1 + delta; s != s2; s += delta)
                   BetweenBB[s1][s2] |= s;
 
-              PieceType pc = (PseudoAttacks[BISHOP][s1] & s2) ? BISHOP : ROOK;
-              LineBB[s1][s2] = (PseudoAttacks[pc][s1] & PseudoAttacks[pc][s2]) | s1 | s2;
+              PieceType pt = (PseudoAttacks[BISHOP][s1] & s2) ? BISHOP : ROOK;
+              LineBB[s1][s2] = (PseudoAttacks[pt][s1] & PseudoAttacks[pt][s2]) | s1 | s2;
           }
 }
 
index deba91d..1dc6f26 100644 (file)
@@ -227,8 +227,7 @@ inline Bitboard squares_of_color(Square s) {
 /// either on a straight or on a diagonal line.
 
 inline bool squares_aligned(Square s1, Square s2, Square s3) {
-  return  (BetweenBB[s1][s2] | BetweenBB[s1][s3] | BetweenBB[s2][s3])
-        & (     SquareBB[s1] |      SquareBB[s2] |      SquareBB[s3]);
+  return LineBB[s1][s2] & s3;
 }