]> git.sesse.net Git - stockfish/blobdiff - src/bitboard.h
Use constexpr when makes sense
[stockfish] / src / bitboard.h
index c9f199eee0105c910fa7c9bc539bf113d7e4884f..ba1b0072bce5079064b5f59cbe26328cb7b6dc03 100644 (file)
@@ -126,7 +126,7 @@ inline Bitboard& operator^=(Bitboard& b, Square s) {
   return b ^= SquareBB[s];
 }
 
   return b ^= SquareBB[s];
 }
 
-inline bool more_than_one(Bitboard b) {
+constexpr bool more_than_one(Bitboard b) {
   return b & (b - 1);
 }
 
   return b & (b - 1);
 }
 
@@ -154,7 +154,7 @@ inline Bitboard file_bb(Square s) {
 /// shift() moves a bitboard one step along direction D. Mainly for pawns
 
 template<Square D>
 /// shift() moves a bitboard one step along direction D. Mainly for pawns
 
 template<Square D>
-inline Bitboard shift(Bitboard b) {
+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
   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