X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftypes.h;h=5a80402d94c2d1838cc5d84ad9d169695e28618c;hp=f041e29db5102c7defa5ad8a250d20b2309d76c4;hb=f12449d492f75a83f9cd3a24cdb461bc3595536f;hpb=708cb311a040ca8c676524025c9d72ed4c632267 diff --git a/src/types.h b/src/types.h index f041e29d..5a80402d 100644 --- a/src/types.h +++ b/src/types.h @@ -124,20 +124,20 @@ enum CastlingSide { KING_SIDE, QUEEN_SIDE, CASTLING_SIDE_NB = 2 }; -enum CastlingFlag { // Defined as in PolyGlot book hash key +enum CastlingRight { // Defined as in PolyGlot book hash key NO_CASTLING, WHITE_OO, WHITE_OOO = WHITE_OO << 1, BLACK_OO = WHITE_OO << 2, BLACK_OOO = WHITE_OO << 3, ANY_CASTLING = WHITE_OO | WHITE_OOO | BLACK_OO | BLACK_OOO, - CASTLING_FLAG_NB = 16 + CASTLING_RIGHT_NB = 16 }; template struct MakeCastling { - static const CastlingFlag - flag = C == WHITE ? S == QUEEN_SIDE ? WHITE_OOO : WHITE_OO - : S == QUEEN_SIDE ? BLACK_OOO : BLACK_OO; + static const CastlingRight + right = C == WHITE ? S == QUEEN_SIDE ? WHITE_OOO : WHITE_OO + : S == QUEEN_SIDE ? BLACK_OOO : BLACK_OO; }; enum Phase { @@ -322,11 +322,11 @@ extern Value PieceValue[PHASE_NB][PIECE_NB]; struct ExtMove { Move move; - int score; + Value value; }; inline bool operator<(const ExtMove& f, const ExtMove& s) { - return f.score < s.score; + return f.value < s.value; } inline Color operator~(Color c) { @@ -337,12 +337,8 @@ inline Square operator~(Square s) { return Square(s ^ SQ_A8); // Vertical flip SQ_A1 -> SQ_A8 } -inline Square operator|(File f, Rank r) { - return Square((r << 3) | f); -} - -inline CastlingFlag operator|(Color c, CastlingSide s) { - return CastlingFlag(WHITE_OO << ((s == QUEEN_SIDE) + 2 * c)); +inline CastlingRight operator|(Color c, CastlingSide s) { + return CastlingRight(WHITE_OO << ((s == QUEEN_SIDE) + 2 * c)); } inline Value mate_in(int ply) { @@ -353,6 +349,10 @@ inline Value mated_in(int ply) { return -VALUE_MATE + ply; } +inline Square make_square(File f, Rank r) { + return Square((r << 3) | f); +} + inline Piece make_piece(Color c, PieceType pt) { return Piece((c << 3) | pt); }