X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftypes.h;h=c77d804037ee7a094b54843b1482801baa2c6aed;hp=3559d72b5ee93627019d2f25043ec61f8fe07004;hb=e5cfa14f40a38d99d11a9c048c34858e3145fbcd;hpb=3984b8f8f0e1f53c737020c936f2a8372029545d diff --git a/src/types.h b/src/types.h index 3559d72b..c77d8040 100644 --- a/src/types.h +++ b/src/types.h @@ -345,6 +345,11 @@ inline Score operator*(Score s, int i) { return result; } +/// Multiplication of a Score by an boolean +inline Score operator*(Score s, bool b) { + return Score(int(s) * int(b)); +} + constexpr Color operator~(Color c) { return Color(c ^ BLACK); // Toggle color } @@ -442,6 +447,10 @@ constexpr Move make_move(Square from, Square to) { return Move((from << 6) + to); } +constexpr Move reverse_move(Move m) { + return make_move(to_sq(m), from_sq(m)); +} + template constexpr Move make(Square from, Square to, PieceType pt = KNIGHT) { return Move(T + ((pt - KNIGHT) << 12) + (from << 6) + to);