From: Marco Costalba Date: Wed, 19 Jan 2011 09:53:47 +0000 (+0100) Subject: Retire some unused functions in bitboard.h X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=45acec1865f19297d91c6aff0ba64b990ad7d242;hp=a38b14bd333b73bab84125b272cecf2291f82a27 Retire some unused functions in bitboard.h No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/bitboard.h b/src/bitboard.h index 42c096d1..6e373952 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -18,23 +18,13 @@ along with this program. If not, see . */ - #if !defined(BITBOARD_H_INCLUDED) #define BITBOARD_H_INCLUDED -//// -//// Includes -//// - #include "piece.h" #include "square.h" #include "types.h" - -//// -//// Constants and variables -//// - const Bitboard EmptyBoardBB = 0; const Bitboard FileABB = 0x0101010101010101ULL; @@ -92,10 +82,6 @@ extern Bitboard QueenPseudoAttacks[64]; extern uint8_t BitCount8Bit[256]; -//// -//// Inline functions -//// - /// Functions for testing whether a given bit is set in a bitboard, and for /// setting and clearing bits. @@ -123,7 +109,8 @@ inline void do_move_bb(Bitboard *b, Bitboard move_bb) { *b ^= move_bb; } -/// rank_bb() and file_bb() take a file or a square as input, and return + +/// rank_bb() and file_bb() take a file or a square as input and return /// a bitboard representing all squares on the given file or rank. inline Bitboard rank_bb(Rank r) { @@ -131,7 +118,7 @@ inline Bitboard rank_bb(Rank r) { } inline Bitboard rank_bb(Square s) { - return rank_bb(square_rank(s)); + return RankBB[square_rank(s)]; } inline Bitboard file_bb(File f) { @@ -139,11 +126,11 @@ inline Bitboard file_bb(File f) { } inline Bitboard file_bb(Square s) { - return file_bb(square_file(s)); + return FileBB[square_file(s)]; } -/// neighboring_files_bb takes a file or a square as input, and returns a +/// neighboring_files_bb takes a file or a square as input and returns a /// bitboard representing all squares on the neighboring files. inline Bitboard neighboring_files_bb(File f) { @@ -155,9 +142,8 @@ inline Bitboard neighboring_files_bb(Square s) { } -/// this_and_neighboring_files_bb takes a file or a square as input, and -/// returns a bitboard representing all squares on the given and neighboring -/// files. +/// this_and_neighboring_files_bb takes a file or a square as input and returns +/// a bitboard representing all squares on the given and neighboring files. inline Bitboard this_and_neighboring_files_bb(File f) { return ThisAndNeighboringFilesBB[f]; @@ -194,19 +180,6 @@ inline Bitboard in_front_bb(Color c, Square s) { } -/// behind_bb() takes a color and a rank or square as input, and returns a -/// bitboard representing all the squares on all ranks behind of the rank -/// (or square), from the given color's point of view. - -inline Bitboard behind_bb(Color c, Rank r) { - return InFrontBB[opposite_color(c)][r]; -} - -inline Bitboard behind_bb(Color c, Square s) { - return InFrontBB[opposite_color(c)][square_rank(s)]; -} - - /// Functions for computing sliding attack bitboards. rook_attacks_bb(), /// bishop_attacks_bb() and queen_attacks_bb() all take a square and a /// bitboard of occupied squares as input, and return a bitboard representing @@ -269,14 +242,6 @@ inline Bitboard squares_in_front_of(Color c, Square s) { } -/// squares_behind is similar to squares_in_front, but returns the squares -/// behind the square instead of in front of the square. - -inline Bitboard squares_behind(Color c, Square s) { - return SquaresInFrontMask[opposite_color(c)][s]; -} - - /// passed_pawn_mask takes a color and a square as input, and returns a /// bitboard mask which can be used to test if a pawn of the given color on /// the given square is a passed pawn. Definition of the table is: @@ -332,12 +297,7 @@ extern Square pop_1st_bit(Bitboard* b); #endif -//// -//// Prototypes -//// - extern void print_bitboard(Bitboard b); extern void init_bitboards(); - #endif // !defined(BITBOARD_H_INCLUDED) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index fe964935..680b8e0f 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -569,7 +569,7 @@ namespace { // problem, especially when that pawn is also blocked. if (s == relative_square(Us, SQ_A1) || s == relative_square(Us, SQ_H1)) { - SquareDelta d = pawn_push(Us) + SquareDelta d = pawn_push(Us) + (square_file(s) == FILE_A ? DELTA_E : DELTA_W); if (pos.piece_on(s + d) == piece_of_color_and_type(Us, PAWN)) { @@ -840,8 +840,8 @@ namespace { // If there is an enemy rook or queen attacking the pawn from behind, // add all X-ray attacks by the rook or queen. Otherwise consider only // the squares in the pawn's path attacked or occupied by the enemy. - if ( (squares_behind(Us, s) & pos.pieces(ROOK, QUEEN, Them)) - && (squares_behind(Us, s) & pos.pieces(ROOK, QUEEN, Them) & pos.attacks_from(s))) + if ( (squares_in_front_of(Them, s) & pos.pieces(ROOK, QUEEN, Them)) + && (squares_in_front_of(Them, s) & pos.pieces(ROOK, QUEEN, Them) & pos.attacks_from(s))) unsafeSquares = squaresToQueen; else unsafeSquares = squaresToQueen & (ei.attackedBy[Them][0] | pos.pieces_of_color(Them));