Remove make_bitboard()
In current master, the function make_bitboard() does nothing apart from helping initialize the SquareBB[] array. This seems like an unnecessary abstraction layer. The advantage of make_bitboard() is we can define a bitboard, in a simple and general way, not only from a single square but also from a list of squares. It is more elegant, faster and readable than combining multiple SquareBB explicitly, but the last complex use case in evaluation was simplified away a few months ago. If make_bitboard() becomes useful again to define complicated bitboards, it will be easy enough to reintroduce it using this pull request as an implementation reference. No functional change.pull/1652/merge
parent
1e9397a2df
commit
af6072c8b7
|
@ -89,7 +89,7 @@ void Bitboards::init() {
|
|||
PopCnt16[i] = (uint8_t) popcount16(i);
|
||||
|
||||
for (Square s = SQ_A1; s <= SQ_H8; ++s)
|
||||
SquareBB[s] = make_bitboard(s);
|
||||
SquareBB[s] = (1ULL << s);
|
||||
|
||||
for (File f = FILE_A; f <= FILE_H; ++f)
|
||||
FileBB[f] = f > FILE_A ? FileBB[f - 1] << 1 : FileABB;
|
||||
|
|
|
@ -155,16 +155,6 @@ inline Bitboard file_bb(Square s) {
|
|||
}
|
||||
|
||||
|
||||
/// make_bitboard() returns a bitboard from a list of squares
|
||||
|
||||
constexpr Bitboard make_bitboard() { return 0; }
|
||||
|
||||
template<typename ...Squares>
|
||||
constexpr Bitboard make_bitboard(Square s, Squares... squares) {
|
||||
return (1ULL << s) | make_bitboard(squares...);
|
||||
}
|
||||
|
||||
|
||||
/// shift() moves a bitboard one step along direction D (mainly for pawns)
|
||||
|
||||
template<Direction D>
|
||||
|
|
Loading…
Reference in New Issue