From: Marco Costalba Date: Sun, 23 Jun 2013 08:03:48 +0000 (+0200) Subject: Retire ThisAndAdjacentFilesBB[] X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=b2fadf32aa57012f2140bc32d5f2433efae3e730 Retire ThisAndAdjacentFilesBB[] It is unused. Also renamed attack_span_mask to pawn_attack_span No functional change. --- diff --git a/src/bitboard.cpp b/src/bitboard.cpp index a3c12ca3..756f0499 100644 --- a/src/bitboard.cpp +++ b/src/bitboard.cpp @@ -42,14 +42,13 @@ Bitboard SquareBB[SQUARE_NB]; Bitboard FileBB[FILE_NB]; Bitboard RankBB[RANK_NB]; Bitboard AdjacentFilesBB[FILE_NB]; -Bitboard ThisAndAdjacentFilesBB[FILE_NB]; Bitboard InFrontBB[COLOR_NB][RANK_NB]; Bitboard StepAttacksBB[PIECE_NB][SQUARE_NB]; Bitboard BetweenBB[SQUARE_NB][SQUARE_NB]; Bitboard DistanceRingsBB[SQUARE_NB][8]; Bitboard ForwardBB[COLOR_NB][SQUARE_NB]; Bitboard PassedPawnMask[COLOR_NB][SQUARE_NB]; -Bitboard AttackSpanMask[COLOR_NB][SQUARE_NB]; +Bitboard PawnAttackSpan[COLOR_NB][SQUARE_NB]; Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB]; int SquareDistance[SQUARE_NB][SQUARE_NB]; @@ -171,10 +170,7 @@ void Bitboards::init() { } for (File f = FILE_A; f <= FILE_H; f++) - { AdjacentFilesBB[f] = (f > FILE_A ? FileBB[f - 1] : 0) | (f < FILE_H ? FileBB[f + 1] : 0); - ThisAndAdjacentFilesBB[f] = FileBB[f] | AdjacentFilesBB[f]; - } for (Rank r = RANK_1; r < RANK_8; r++) InFrontBB[WHITE][r] = ~(InFrontBB[BLACK][r + 1] = InFrontBB[BLACK][r] | RankBB[r]); @@ -183,8 +179,8 @@ void Bitboards::init() { for (Square s = SQ_A1; s <= SQ_H8; s++) { ForwardBB[c][s] = InFrontBB[c][rank_of(s)] & FileBB[file_of(s)]; - PassedPawnMask[c][s] = InFrontBB[c][rank_of(s)] & ThisAndAdjacentFilesBB[file_of(s)]; - AttackSpanMask[c][s] = InFrontBB[c][rank_of(s)] & AdjacentFilesBB[file_of(s)]; + PawnAttackSpan[c][s] = InFrontBB[c][rank_of(s)] & AdjacentFilesBB[file_of(s)]; + PassedPawnMask[c][s] = ForwardBB[c][s] | PawnAttackSpan[c][s]; } for (Square s1 = SQ_A1; s1 <= SQ_H8; s1++) diff --git a/src/bitboard.h b/src/bitboard.h index 06adbfe3..07b0f9ba 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -53,14 +53,13 @@ extern Bitboard SquareBB[SQUARE_NB]; extern Bitboard FileBB[FILE_NB]; extern Bitboard RankBB[RANK_NB]; extern Bitboard AdjacentFilesBB[FILE_NB]; -extern Bitboard ThisAndAdjacentFilesBB[FILE_NB]; extern Bitboard InFrontBB[COLOR_NB][RANK_NB]; extern Bitboard StepAttacksBB[PIECE_NB][SQUARE_NB]; extern Bitboard BetweenBB[SQUARE_NB][SQUARE_NB]; extern Bitboard DistanceRingsBB[SQUARE_NB][8]; extern Bitboard ForwardBB[COLOR_NB][SQUARE_NB]; extern Bitboard PassedPawnMask[COLOR_NB][SQUARE_NB]; -extern Bitboard AttackSpanMask[COLOR_NB][SQUARE_NB]; +extern Bitboard PawnAttackSpan[COLOR_NB][SQUARE_NB]; extern Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB]; const Bitboard BlackSquares = 0xAA55AA55AA55AA55ULL; @@ -136,14 +135,6 @@ inline Bitboard adjacent_files_bb(File f) { } -/// this_and_adjacent_files_bb takes a file as input and returns a bitboard -/// representing all squares on the given and adjacent files. - -inline Bitboard this_and_adjacent_files_bb(File f) { - return ThisAndAdjacentFilesBB[f]; -} - - /// in_front_bb() takes a color and a rank or square as input, and returns a /// bitboard representing all the squares on all ranks in front of the rank /// (or square), from the given color's point of view. For instance, @@ -194,8 +185,8 @@ inline Bitboard passed_pawn_mask(Color c, Square s) { /// when it moves along its file starting from the given square. Definition is: /// AttackSpanMask[c][s] = in_front_bb(c, s) & adjacent_files_bb(s); -inline Bitboard attack_span_mask(Color c, Square s) { - return AttackSpanMask[c][s]; +inline Bitboard pawn_attack_span(Color c, Square s) { + return PawnAttackSpan[c][s]; } diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 945fb4e4..9584c0ed 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -530,7 +530,7 @@ Value do_evaluate(const Position& pos, Value& margin) { // Bishop and knight outposts squares if ( (Piece == BISHOP || Piece == KNIGHT) - && !(pos.pieces(Them, PAWN) & attack_span_mask(Us, s))) + && !(pos.pieces(Them, PAWN) & pawn_attack_span(Us, s))) score += evaluate_outposts(pos, ei, s); if ( (Piece == ROOK || Piece == QUEEN) @@ -999,7 +999,7 @@ Value do_evaluate(const Position& pos, Value& margin) { } // Check pawns that can be sacrificed against the blocking pawn - b2 = attack_span_mask(winnerSide, blockSq) & candidates & ~(1ULL << s); + b2 = pawn_attack_span(winnerSide, blockSq) & candidates & ~(1ULL << s); while (b2) // This while-loop could be replaced with LSB/MSB (depending on color) { diff --git a/src/pawns.cpp b/src/pawns.cpp index e1952b60..ea5f9287 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -134,7 +134,7 @@ namespace { // be backward. If there are friendly pawns behind on adjacent files // or if can capture an enemy pawn it cannot be backward either. if ( !(passed | isolated | chain) - && !(ourPawns & attack_span_mask(Them, s)) + && !(ourPawns & pawn_attack_span(Them, s)) && !(pos.attacks_from(s, Us) & theirPawns)) { // We now know that there are no friendly pawns beside or behind this @@ -153,15 +153,15 @@ namespace { backward = (b | shift_bb(b)) & theirPawns; } - assert(opposed | passed | (attack_span_mask(Us, s) & theirPawns)); + assert(opposed | passed | (pawn_attack_span(Us, s) & theirPawns)); // A not passed pawn is a candidate to become passed if it is free to // advance and if the number of friendly pawns beside or behind this // pawn on adjacent files is higher or equal than the number of // enemy pawns in the forward direction on the adjacent files. candidate = !(opposed | passed | backward | isolated) - && (b = attack_span_mask(Them, s + pawn_push(Us)) & ourPawns) != 0 - && popcount(b) >= popcount(attack_span_mask(Us, s) & theirPawns); + && (b = pawn_attack_span(Them, s + pawn_push(Us)) & ourPawns) != 0 + && popcount(b) >= popcount(pawn_attack_span(Us, s) & theirPawns); // Passed pawns will be properly scored in evaluation because we need // full attack info to evaluate passed pawns. Only the frontmost passed