From: protonspring Date: Sun, 17 Jun 2018 02:26:25 +0000 (-0600) Subject: Remove make_bitboard() X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=af6072c8b7e849c43b69dc286bcc0de6d9b453a1 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. --- diff --git a/src/bitboard.cpp b/src/bitboard.cpp index b19d401a..96f0517f 100644 --- a/src/bitboard.cpp +++ b/src/bitboard.cpp @@ -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; diff --git a/src/bitboard.h b/src/bitboard.h index 7ae1effd..54df6c2d 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -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 -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