X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbitboard.h;h=8d748eeed8615628ddd4b044df9c34aef4fcaeff;hp=ef5c4fa304ab1beb366077a36720dab9782744d4;hb=3ef0c3c34a00e6b13d6c96d8c2f0d8d7a6cc25a6;hpb=14e23d520f251f28234a686a9d30d9711495dfef diff --git a/src/bitboard.h b/src/bitboard.h index ef5c4fa3..8d748eee 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -119,6 +119,12 @@ inline Bitboard operator^( Bitboard b, Square s) { return b ^ square_bb(s); } inline Bitboard& operator|=(Bitboard& b, Square s) { return b |= square_bb(s); } inline Bitboard& operator^=(Bitboard& b, Square s) { return b ^= square_bb(s); } +inline Bitboard operator&(Square s, Bitboard b) { return b & s; } +inline Bitboard operator|(Square s, Bitboard b) { return b | s; } +inline Bitboard operator^(Square s, Bitboard b) { return b ^ s; } + +inline Bitboard operator|(Square s, Square s2) { return square_bb(s) | square_bb(s2); } + constexpr bool more_than_one(Bitboard b) { return b & (b - 1); } @@ -376,10 +382,9 @@ inline Square pop_lsb(Bitboard* b) { } -/// frontmost_sq() and backmost_sq() return the most/least advanced square in -/// the given bitboard relative to the given color. - -inline Square frontmost_sq(Color c, Bitboard b) { return c == WHITE ? msb(b) : lsb(b); } -inline Square backmost_sq(Color c, Bitboard b) { return c == WHITE ? lsb(b) : msb(b); } +/// frontmost_sq() returns the most advanced square for the given color +inline Square frontmost_sq(Color c, Bitboard b) { + return c == WHITE ? msb(b) : lsb(b); +} #endif // #ifndef BITBOARD_H_INCLUDED