]> git.sesse.net Git - stockfish/commitdiff
Remove make_bitboard()
authorprotonspring <mike@whiteley.org>
Sun, 17 Jun 2018 02:26:25 +0000 (20:26 -0600)
committerStéphane Nicolet <cassio@free.fr>
Tue, 26 Jun 2018 07:08:15 +0000 (09:08 +0200)
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.

src/bitboard.cpp
src/bitboard.h

index b19d401af19ad6e13bf36071cdba05cbca9bca5f..96f0517f12f223a7558f6f27ef749da6aa22602c 100644 (file)
@@ -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;
index 7ae1effd9487f036407f3429c8a5047ec6f52023..54df6c2d61878546202eeb07bded007df8b19489 100644 (file)
@@ -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>