1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

Retire some unused functions in bitboard.h

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-01-19 10:53:47 +01:00
parent a38b14bd33
commit 45acec1865
2 changed files with 10 additions and 50 deletions

View file

@ -18,23 +18,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#if !defined(BITBOARD_H_INCLUDED) #if !defined(BITBOARD_H_INCLUDED)
#define BITBOARD_H_INCLUDED #define BITBOARD_H_INCLUDED
////
//// Includes
////
#include "piece.h" #include "piece.h"
#include "square.h" #include "square.h"
#include "types.h" #include "types.h"
////
//// Constants and variables
////
const Bitboard EmptyBoardBB = 0; const Bitboard EmptyBoardBB = 0;
const Bitboard FileABB = 0x0101010101010101ULL; const Bitboard FileABB = 0x0101010101010101ULL;
@ -92,10 +82,6 @@ extern Bitboard QueenPseudoAttacks[64];
extern uint8_t BitCount8Bit[256]; extern uint8_t BitCount8Bit[256];
////
//// Inline functions
////
/// Functions for testing whether a given bit is set in a bitboard, and for /// Functions for testing whether a given bit is set in a bitboard, and for
/// setting and clearing bits. /// setting and clearing bits.
@ -123,7 +109,8 @@ inline void do_move_bb(Bitboard *b, Bitboard move_bb) {
*b ^= 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. /// a bitboard representing all squares on the given file or rank.
inline Bitboard rank_bb(Rank r) { inline Bitboard rank_bb(Rank r) {
@ -131,7 +118,7 @@ inline Bitboard rank_bb(Rank r) {
} }
inline Bitboard rank_bb(Square s) { inline Bitboard rank_bb(Square s) {
return rank_bb(square_rank(s)); return RankBB[square_rank(s)];
} }
inline Bitboard file_bb(File f) { inline Bitboard file_bb(File f) {
@ -139,11 +126,11 @@ inline Bitboard file_bb(File f) {
} }
inline Bitboard file_bb(Square s) { 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. /// bitboard representing all squares on the neighboring files.
inline Bitboard neighboring_files_bb(File f) { 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 /// this_and_neighboring_files_bb takes a file or a square as input and returns
/// returns a bitboard representing all squares on the given and neighboring /// a bitboard representing all squares on the given and neighboring files.
/// files.
inline Bitboard this_and_neighboring_files_bb(File f) { inline Bitboard this_and_neighboring_files_bb(File f) {
return ThisAndNeighboringFilesBB[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(), /// Functions for computing sliding attack bitboards. rook_attacks_bb(),
/// bishop_attacks_bb() and queen_attacks_bb() all take a square and a /// bishop_attacks_bb() and queen_attacks_bb() all take a square and a
/// bitboard of occupied squares as input, and return a bitboard representing /// 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 /// 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 /// 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: /// the given square is a passed pawn. Definition of the table is:
@ -332,12 +297,7 @@ extern Square pop_1st_bit(Bitboard* b);
#endif #endif
////
//// Prototypes
////
extern void print_bitboard(Bitboard b); extern void print_bitboard(Bitboard b);
extern void init_bitboards(); extern void init_bitboards();
#endif // !defined(BITBOARD_H_INCLUDED) #endif // !defined(BITBOARD_H_INCLUDED)

View file

@ -840,8 +840,8 @@ namespace {
// If there is an enemy rook or queen attacking the pawn from behind, // 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 // 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. // the squares in the pawn's path attacked or occupied by the enemy.
if ( (squares_behind(Us, s) & pos.pieces(ROOK, QUEEN, Them)) if ( (squares_in_front_of(Them, s) & pos.pieces(ROOK, QUEEN, Them))
&& (squares_behind(Us, s) & pos.pieces(ROOK, QUEEN, Them) & pos.attacks_from<ROOK>(s))) && (squares_in_front_of(Them, s) & pos.pieces(ROOK, QUEEN, Them) & pos.attacks_from<ROOK>(s)))
unsafeSquares = squaresToQueen; unsafeSquares = squaresToQueen;
else else
unsafeSquares = squaresToQueen & (ei.attackedBy[Them][0] | pos.pieces_of_color(Them)); unsafeSquares = squaresToQueen & (ei.attackedBy[Them][0] | pos.pieces_of_color(Them));