Store pawn attacks in PawnInfo

They are pawn structure invariant so has a sense to
store togheter with pawn info instead of recalculating
them each time evaluate() is called.

Speed up is around 1%

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2009-09-30 08:07:46 +01:00
parent 237dd331d5
commit e677185567
3 changed files with 12 additions and 2 deletions

View File

@@ -193,6 +193,10 @@ PawnInfo* PawnInfoTable::get_pawn_info(const Position& pos) {
Value mgValue[2] = {Value(0), Value(0)};
Value egValue[2] = {Value(0), Value(0)};
// Calculate pawn attacks
pi->pawnAttacks[WHITE] = ((pos.pieces(PAWN, WHITE) << 9) & ~FileABB) | ((pos.pieces(PAWN, WHITE) << 7) & ~FileHBB);
pi->pawnAttacks[BLACK] = ((pos.pieces(PAWN, BLACK) >> 7) & ~FileABB) | ((pos.pieces(PAWN, BLACK) >> 9) & ~FileHBB);
// Loop through the pawns for both colors
for (Color us = WHITE; us <= BLACK; us++)
{