X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Ftypes.h;h=b7bcb4e89f168c9fdf48cdad1fcfc9d596712ccd;hb=3b14b17664b30933e55d0fb1c8248ddab8b49110;hp=9b36fd89fde9f9505dc54a2093bab49711cbf651;hpb=52f55179a8d0b24f5410cdd9d29559e4f6408156;p=stockfish diff --git a/src/types.h b/src/types.h index 9b36fd89..b7bcb4e8 100644 --- a/src/types.h +++ b/src/types.h @@ -35,6 +35,7 @@ /// | only in 64-bit mode. For compiling requires hardware with /// | popcnt support. +#include #include #include #include @@ -391,7 +392,8 @@ inline PieceType type_of(Piece p) { } inline Color color_of(Piece p) { - return p == NO_PIECE ? NO_COLOR : Color(p >> 3); + assert(p != NO_PIECE); + return Color(p >> 3); } inline bool is_ok(Square s) { @@ -439,8 +441,8 @@ inline int square_distance(Square s1, Square s2) { return SquareDistance[s1][s2]; } -inline char file_to_char(File f) { - return char(f - FILE_A + 'a'); +inline char file_to_char(File f, bool tolower = true) { + return char(f - FILE_A + (tolower ? 'a' : 'A')); } inline char rank_to_char(Rank r) { @@ -473,7 +475,7 @@ inline Move make_move(Square from, Square to) { template inline Move make(Square from, Square to, PieceType pt = KNIGHT) { - return Move(to | (from << 6) | T | ((pt - KNIGHT) << 12)) ; + return Move(to | (from << 6) | T | ((pt - KNIGHT) << 12)); } inline bool is_ok(Move m) {