mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
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.
This commit is contained in:
parent
1e9397a2df
commit
af6072c8b7
2 changed files with 1 additions and 11 deletions
|
@ -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…
Add table
Reference in a new issue