X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbitboard.h;h=87628c0ce7b483c5f4cf9e75732aa40917a9e117;hp=c9f199eee0105c910fa7c9bc539bf113d7e4884f;hb=d19348221395a5939603bbd1364fda60e4ffd2ee;hpb=002bf4d8dbf804ce8303e01733341a0922af2e71 diff --git a/src/bitboard.h b/src/bitboard.h index c9f199ee..87628c0c 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -126,11 +126,10 @@ inline Bitboard& operator^=(Bitboard& b, Square s) { return b ^= SquareBB[s]; } -inline bool more_than_one(Bitboard b) { +constexpr bool more_than_one(Bitboard b) { return b & (b - 1); } - /// rank_bb() and file_bb() return a bitboard representing all the squares on /// the given file or rank. @@ -153,8 +152,8 @@ inline Bitboard file_bb(Square s) { /// shift() moves a bitboard one step along direction D. Mainly for pawns -template -inline Bitboard shift(Bitboard b) { +template +constexpr Bitboard shift(Bitboard b) { return D == NORTH ? b << 8 : D == SOUTH ? b >> 8 : D == NORTH_EAST ? (b & ~FileHBB) << 9 : D == SOUTH_EAST ? (b & ~FileHBB) >> 7 : D == NORTH_WEST ? (b & ~FileABB) << 7 : D == SOUTH_WEST ? (b & ~FileABB) >> 9