]> git.sesse.net Git - stockfish/commitdiff
Retire TheirHalf[]
authorMarco Costalba <mcostalba@gmail.com>
Wed, 4 Dec 2013 16:24:32 +0000 (17:24 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 4 Dec 2013 16:45:09 +0000 (17:45 +0100)
We avoid to use an ad-hoc table at the cost of a
relative_rank() call in advanced_pawn_push().

On my 32 bit system it is even slightly faster (on 64bit
may be different). This is the speed in nps alternating
old and new bench runs:

new

368890
368825
369972

old

367798
367635
368026

No functional change.

src/bitboard.h
src/position.h

index ceac2c24ed5b05f86866e14511347aa8a0ed7caf..8154f574c6d7baedde7ccea8d50e94005db7fdfb 100644 (file)
@@ -84,8 +84,6 @@ extern Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB];
 extern int SquareDistance[SQUARE_NB][SQUARE_NB];
 
 const Bitboard DarkSquares = 0xAA55AA55AA55AA55ULL;
-const Bitboard TheirHalf[COLOR_NB] = { Rank5BB | Rank6BB | Rank7BB | Rank8BB,
-                                       Rank1BB | Rank2BB | Rank3BB | Rank4BB };
 
 /// Overloads of bitwise operators between a Bitboard and a Square for testing
 /// whether a given bit is set in a bitboard, and for setting and clearing bits.
index 6defeb22bd9cedc8fbab20b6a50c28773974bc0e..4e15bb136f9997d98e9e070243d142b9836efca2 100644 (file)
@@ -327,7 +327,8 @@ inline bool Position::pawn_passed(Color c, Square s) const {
 }
 
 inline bool Position::advanced_pawn_push(Move m) const {
-  return pieces(PAWN) & TheirHalf[sideToMove] & from_sq(m);
+  return   type_of(moved_piece(m)) == PAWN
+        && relative_rank(sideToMove, from_sq(m)) > RANK_4;
 }
 
 inline Key Position::key() const {