X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftypes.h;h=17661c01e800a12b3ee61108173e8773be171477;hp=4a78cc81d03040080923e4b6c4ea1f1fe44b2e30;hb=dc7fd868f4fa41251a9521a0b25e3adb483bfd83;hpb=7b4aa1070882cba085c9d6ed03d934734c395fe5 diff --git a/src/types.h b/src/types.h index 4a78cc81..17661c01 100644 --- a/src/types.h +++ b/src/types.h @@ -119,15 +119,13 @@ enum Move { MOVE_NULL = 65 }; -struct MoveStack { - Move move; - int score; +enum MoveType { + NORMAL = 0, + PROMOTION = 1 << 14, + ENPASSANT = 2 << 14, + CASTLE = 3 << 14 }; -inline bool operator<(const MoveStack& f, const MoveStack& s) { - return f.score < s.score; -} - enum CastleRight { // Defined as in PolyGlot book hash key CASTLES_NONE = 0, WHITE_OO = 1, @@ -327,6 +325,15 @@ extern const Value PieceValueMidgame[17]; // Indexed by Piece or PieceType extern const Value PieceValueEndgame[17]; extern int SquareDistance[64][64]; +struct MoveStack { + Move move; + int score; +}; + +inline bool operator<(const MoveStack& f, const MoveStack& s) { + return f.score < s.score; +} + inline Color operator~(Color c) { return Color(c ^ 1); } @@ -432,20 +439,8 @@ inline Square to_sq(Move m) { return Square(m & 0x3F); } -inline bool is_special(Move m) { - return m & (3 << 14); -} - -inline bool is_promotion(Move m) { - return (m & (3 << 14)) == (1 << 14); -} - -inline int is_enpassant(Move m) { - return (m & (3 << 14)) == (2 << 14); -} - -inline int is_castle(Move m) { - return (m & (3 << 14)) == (3 << 14); +inline MoveType type_of(Move m) { + return MoveType(m & (3 << 14)); } inline PieceType promotion_type(Move m) {