From c45818e9f86fea63a6b46d0726cdcfe87516d01b Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Tue, 17 Feb 2009 17:26:15 +0100 Subject: [PATCH] Remove xxx_of_color() for real Remove also from assert expressions. Was hidden in release mode. No functional change. Signed-off-by: Marco Costalba --- src/evaluate.cpp | 6 +++--- src/movegen.cpp | 14 +++++++------- src/pawns.cpp | 2 +- src/position.cpp | 24 ++++++++++++------------ 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index a01a3c2c..4984d08c 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -926,7 +926,7 @@ namespace { { Square s = pop_1st_bit(&b); - assert(pos.piece_on(s) == pawn_of_color(us)); + assert(pos.piece_on(s) == piece_of_color_and_type(us, PAWN)); assert(pos.pawn_is_passed(us, s)); int r = int(relative_rank(us, s) - RANK_2); @@ -1077,7 +1077,7 @@ namespace { void evaluate_trapped_bishop_a7h7(const Position &pos, Square s, Color us, EvalInfo &ei) { assert(square_is_ok(s)); - assert(pos.piece_on(s) == bishop_of_color(us)); + assert(pos.piece_on(s) == piece_of_color_and_type(us, BISHOP)); Square b6 = relative_square(us, (square_file(s) == FILE_A) ? SQ_B6 : SQ_G6); Square b8 = relative_square(us, (square_file(s) == FILE_A) ? SQ_B8 : SQ_G8); @@ -1104,7 +1104,7 @@ namespace { assert(Chess960); assert(square_is_ok(s)); - assert(pos.piece_on(s) == bishop_of_color(us)); + assert(pos.piece_on(s) == piece_of_color_and_type(us, BISHOP)); if (square_file(s) == FILE_A) { diff --git a/src/movegen.cpp b/src/movegen.cpp index a002e19f..258f9c71 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -175,7 +175,7 @@ int generate_checks(const Position& pos, MoveStack* mlist, Bitboard dc) { Square ksq = pos.king_square(opposite_color(us)); MoveStack* mlist_start = mlist; - assert(pos.piece_on(ksq) == king_of_color(opposite_color(us))); + assert(pos.piece_on(ksq) == piece_of_color_and_type(opposite_color(us), KING)); // Pieces moves mlist = generate_piece_checks(pos, mlist, us, dc, ksq); @@ -215,7 +215,7 @@ int generate_evasions(const Position& pos, MoveStack* mlist, Bitboard pinned) { Square ksq = pos.king_square(us); MoveStack* mlist_start = mlist; - assert(pos.piece_on(ksq) == king_of_color(us)); + assert(pos.piece_on(ksq) == piece_of_color_and_type(us, KING)); // The bitboard of occupied pieces without our king Bitboard b_noKing = pos.occupied_squares(); @@ -400,7 +400,7 @@ bool move_is_legal(const Position& pos, const Move m, Bitboard pinned) { return false; assert(pos.square_is_empty(to)); - assert(pos.piece_on(to - pawn_push(us)) == pawn_of_color(them)); + assert(pos.piece_on(to - pawn_push(us)) == piece_of_color_and_type(them, PAWN)); // The move is pseudo-legal, check if it is also legal return pos.pl_move_is_legal(m, pinned); @@ -417,7 +417,7 @@ bool move_is_legal(const Position& pos, const Move m, Bitboard pinned) { assert(from == pos.king_square(us)); assert(to == pos.initial_kr_square(us)); - assert(pos.piece_on(to) == rook_of_color(us)); + assert(pos.piece_on(to) == piece_of_color_and_type(us, ROOK)); Square g1 = relative_square(us, SQ_G1); Square f1 = relative_square(us, SQ_F1); @@ -450,7 +450,7 @@ bool move_is_legal(const Position& pos, const Move m, Bitboard pinned) { assert(from == pos.king_square(us)); assert(to == pos.initial_qr_square(us)); - assert(pos.piece_on(to) == rook_of_color(us)); + assert(pos.piece_on(to) == piece_of_color_and_type(us, ROOK)); Square c1 = relative_square(us, SQ_C1); Square d1 = relative_square(us, SQ_D1); @@ -866,7 +866,7 @@ namespace { Color them = opposite_color(us); Square ksq = pos.king_square(us); - assert(pos.piece_on(ksq) == king_of_color(us)); + assert(pos.piece_on(ksq) == piece_of_color_and_type(us, KING)); Square rsq = (Side == KING_SIDE ? pos.initial_kr_square(us) : pos.initial_qr_square(us)); Square s1 = relative_square(us, Side == KING_SIDE ? SQ_G1 : SQ_C1); @@ -874,7 +874,7 @@ namespace { Square s; bool illegal = false; - assert(pos.piece_on(rsq) == rook_of_color(us)); + assert(pos.piece_on(rsq) == piece_of_color_and_type(us, ROOK)); // It is a bit complicated to correctly handle Chess960 for (s = Min(ksq, s1); s <= Max(ksq, s1); s++) diff --git a/src/pawns.cpp b/src/pawns.cpp index 6fd3e215..0aacec00 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -216,7 +216,7 @@ PawnInfo *PawnInfoTable::get_pawn_info(const Position &pos) { File f = square_file(s); Rank r = square_rank(s); - assert(pos.piece_on(s) == pawn_of_color(us)); + assert(pos.piece_on(s) == piece_of_color_and_type(us, PAWN)); // The file containing the pawn is not half open pi->halfOpenFiles[us] &= ~(1 << f); diff --git a/src/position.cpp b/src/position.cpp index 1b1fef8a..382073a7 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -493,7 +493,7 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const { Square ksq = king_square(us); assert(color_of_piece_on(from) == us); - assert(piece_on(ksq) == king_of_color(us)); + assert(piece_on(ksq) == piece_of_color_and_type(us, KING)); // En passant captures are a tricky special case. Because they are // rather uncommon, we do it simply by testing whether the king is attacked @@ -505,8 +505,8 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const { Bitboard b = occupied_squares(); assert(to == ep_square()); - assert(piece_on(from) == pawn_of_color(us)); - assert(piece_on(capsq) == pawn_of_color(them)); + assert(piece_on(from) == piece_of_color_and_type(us, PAWN)); + assert(piece_on(capsq) == piece_of_color_and_type(them, PAWN)); assert(piece_on(to) == EMPTY); clear_bit(&b, from); @@ -554,7 +554,7 @@ bool Position::move_is_check(Move m, Bitboard dcCandidates) const { Square ksq = king_square(them); assert(color_of_piece_on(from) == us); - assert(piece_on(ksq) == king_of_color(them)); + assert(piece_on(ksq) == piece_of_color_and_type(them, KING)); // Proceed according to the type of the moving piece switch (type_of_piece_on(from)) @@ -940,8 +940,8 @@ void Position::do_castle_move(Move m) { Square rfrom = move_to(m); // HACK: See comment at beginning of function Square kto, rto; - assert(piece_on(kfrom) == king_of_color(us)); - assert(piece_on(rfrom) == rook_of_color(us)); + assert(piece_on(kfrom) == piece_of_color_and_type(us, KING)); + assert(piece_on(rfrom) == piece_of_color_and_type(us, ROOK)); // Find destination squares for king and rook if (rfrom > kfrom) // O-O @@ -1039,7 +1039,7 @@ void Position::do_promotion_move(Move m, UndoInfo &u) { to = move_to(m); assert(relative_rank(us, to) == RANK_8); - assert(piece_on(from) == pawn_of_color(us)); + assert(piece_on(from) == piece_of_color_and_type(us, PAWN)); assert(color_of_piece_on(to) == them || square_is_empty(to)); capture = type_of_piece_on(to); @@ -1136,8 +1136,8 @@ void Position::do_ep_move(Move m) { assert(to == epSquare); assert(relative_rank(us, to) == RANK_6); assert(piece_on(to) == EMPTY); - assert(piece_on(from) == pawn_of_color(us)); - assert(piece_on(capsq) == pawn_of_color(them)); + assert(piece_on(from) == piece_of_color_and_type(us, PAWN)); + assert(piece_on(capsq) == piece_of_color_and_type(them, PAWN)); // Remove captured piece clear_bit(&(byColorBB[them]), capsq); @@ -1314,8 +1314,8 @@ void Position::undo_castle_move(Move m) { rto = relative_square(us, SQ_D1); } - assert(piece_on(kto) == king_of_color(us)); - assert(piece_on(rto) == rook_of_color(us)); + assert(piece_on(kto) == piece_of_color_and_type(us, KING)); + assert(piece_on(rto) == piece_of_color_and_type(us, ROOK)); // Remove pieces from destination squares clear_bit(&(byColorBB[us]), kto); @@ -1452,7 +1452,7 @@ void Position::undo_ep_move(Move m) { assert(to == ep_square()); assert(relative_rank(us, to) == RANK_6); - assert(piece_on(to) == pawn_of_color(us)); + assert(piece_on(to) == piece_of_color_and_type(us, PAWN)); assert(piece_on(from) == EMPTY); assert(piece_on(capsq) == EMPTY); -- 2.39.2