From: Marco Costalba Date: Mon, 29 Jul 2013 17:32:59 +0000 (+0200) Subject: Small renaming X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=1f40cd6d02374277abb5620d88d6fe58d7e9d6f7 Small renaming No functional change. --- diff --git a/src/bitboard.h b/src/bitboard.h index 859fc958..bc3ed87b 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -82,7 +82,7 @@ extern Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB]; extern int SquareDistance[SQUARE_NB][SQUARE_NB]; -const Bitboard BlackSquares = 0xAA55AA55AA55AA55ULL; +const Bitboard DarkSquares = 0xAA55AA55AA55AA55ULL; /// 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. @@ -214,6 +214,14 @@ inline Bitboard passed_pawn_mask(Color c, Square s) { } +/// squares_of_color() returns a bitboard representing all squares with the same +/// color of the given square. + +inline Bitboard squares_of_color(Square s) { + return DarkSquares & s ? DarkSquares : ~DarkSquares; +} + + /// squares_aligned() returns true if the squares s1, s2 and s3 are aligned /// either on a straight or on a diagonal line. @@ -223,14 +231,6 @@ inline bool squares_aligned(Square s1, Square s2, Square s3) { } -/// same_color_squares() returns a bitboard representing all squares with -/// the same color of the given square. - -inline Bitboard same_color_squares(Square s) { - return BlackSquares & s ? BlackSquares : ~BlackSquares; -} - - /// Functions for computing sliding attack bitboards. Function attacks_bb() takes /// a square and a bitboard of occupied squares as input, and returns a bitboard /// representing all squares attacked by Pt (bishop or rook) on the given square. diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 3f01d564..25ee79ea 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -468,7 +468,7 @@ Value do_evaluate(const Position& pos, Value& margin) { if (bonus && (ei.attackedBy[Us][PAWN] & s)) { if ( !pos.pieces(Them, KNIGHT) - && !(same_color_squares(s) & pos.pieces(Them, BISHOP))) + && !(squares_of_color(s) & pos.pieces(Them, BISHOP))) bonus += bonus + bonus / 2; else bonus += bonus / 2; diff --git a/src/pawns.cpp b/src/pawns.cpp index 74aa0e0d..718dd575 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -104,7 +104,7 @@ namespace { e->kingSquares[Us] = SQ_NONE; e->semiopenFiles[Us] = 0xFF; e->pawnAttacks[Us] = shift_bb(ourPawns) | shift_bb(ourPawns); - e->pawnsOnSquares[Us][BLACK] = popcount(ourPawns & BlackSquares); + e->pawnsOnSquares[Us][BLACK] = popcount(ourPawns & DarkSquares); e->pawnsOnSquares[Us][WHITE] = pos.count(Us) - e->pawnsOnSquares[Us][BLACK]; // Loop through all pawns of the current color and score each pawn diff --git a/src/pawns.h b/src/pawns.h index 7292606b..9f2af30e 100644 --- a/src/pawns.h +++ b/src/pawns.h @@ -37,7 +37,7 @@ struct Entry { Score pawns_value() const { return value; } Bitboard pawn_attacks(Color c) const { return pawnAttacks[c]; } Bitboard passed_pawns(Color c) const { return passedPawns[c]; } - int pawns_on_same_color_squares(Color c, Square s) const { return pawnsOnSquares[c][!!(BlackSquares & s)]; } + int pawns_on_same_color_squares(Color c, Square s) const { return pawnsOnSquares[c][!!(DarkSquares & s)]; } int semiopen(Color c, File f) const { return semiopenFiles[c] & (1 << int(f)); } int semiopen_on_side(Color c, File f, bool left) const {