1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Position: fix a couple of Intel compiler warnings

Plus usual trailing whitespace.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2008-10-26 13:23:27 +01:00
parent 8a85007023
commit a5c1b3e8f6
2 changed files with 31 additions and 35 deletions

View file

@ -39,7 +39,7 @@ namespace {
/// Variables /// Variables
MovePicker::MovegenPhase PhaseTable[32]; MovePicker::MovegenPhase PhaseTable[32];
int MainSearchPhaseIndex; int MainSearchPhaseIndex;
int EvasionsPhaseIndex; int EvasionsPhaseIndex;
int QsearchWithChecksPhaseIndex; int QsearchWithChecksPhaseIndex;
@ -62,7 +62,7 @@ namespace {
/// move ordering is at the current node. /// move ordering is at the current node.
MovePicker::MovePicker(const Position& p, bool pvnode, Move ttm, Move mk, MovePicker::MovePicker(const Position& p, bool pvnode, Move ttm, Move mk,
Move k1, Move k2, Depth d) : pos(p) { Move k1, Move k2, Depth d) : pos(p) {
pvNode = pvnode; pvNode = pvnode;
ttMove = ttm; ttMove = ttm;
mateKiller = (mk == ttm)? MOVE_NONE : mk; mateKiller = (mk == ttm)? MOVE_NONE : mk;
@ -147,13 +147,13 @@ Move MovePicker::get_next_move() {
break; break;
case PH_EVASIONS: case PH_EVASIONS:
assert(pos.is_check()); assert(pos.is_check());
numOfMoves = generate_evasions(pos, moves); numOfMoves = generate_evasions(pos, moves);
score_evasions(); score_evasions();
movesPicked = 0; movesPicked = 0;
break; break;
case PH_QCAPTURES: case PH_QCAPTURES:
numOfMoves = generate_captures(pos, moves); numOfMoves = generate_captures(pos, moves);
score_qcaptures(); score_qcaptures();
movesPicked = 0; movesPicked = 0;
@ -172,8 +172,6 @@ Move MovePicker::get_next_move() {
return MOVE_NONE; return MOVE_NONE;
} }
} }
assert(false);
return MOVE_NONE;
} }
@ -192,7 +190,7 @@ Move MovePicker::get_next_move(Lock &lock) {
if (m == MOVE_NONE) if (m == MOVE_NONE)
finished = true; finished = true;
lock_release(&lock); lock_release(&lock);
return m; return m;
} }
@ -273,20 +271,20 @@ void MovePicker::score_qcaptures() {
} }
/// find_best_index() loops across the moves and returns index of /// find_best_index() loops across the moves and returns index of
/// the highest scored one. /// the highest scored one.
int MovePicker::find_best_index() { int MovePicker::find_best_index() {
int bestScore = -10000000, bestIndex = -1; int bestScore = -10000000, bestIndex = -1;
for (int i = movesPicked; i < numOfMoves; i++) for (int i = movesPicked; i < numOfMoves; i++)
if (moves[i].score > bestScore) if (moves[i].score > bestScore)
{ {
bestIndex = i; bestIndex = i;
bestScore = moves[i].score; bestScore = moves[i].score;
} }
return bestIndex; return bestIndex;
} }
@ -435,8 +433,8 @@ Move MovePicker::pick_move_from_list() {
} }
/// MovePicker::current_move_type() returns the type of the just /// MovePicker::current_move_type() returns the type of the just
/// picked next move. It can be used in search to further differentiate /// picked next move. It can be used in search to further differentiate
/// according to the current move type: capture, non capture, escape, etc. /// according to the current move type: capture, non capture, escape, etc.
MovePicker::MovegenPhase MovePicker::current_move_type() const { MovePicker::MovegenPhase MovePicker::current_move_type() const {

View file

@ -235,7 +235,7 @@ const std::string Position::to_fen() const {
fen += (char)skip + '0'; fen += (char)skip + '0';
skip = 0; skip = 0;
} }
fen += pieceLetters[piece_on(sq)]; fen += pieceLetters[piece_on(sq)];
} }
if (skip > 0) if (skip > 0)
fen += (char)skip + '0'; fen += (char)skip + '0';
@ -327,7 +327,7 @@ Bitboard Position::hidden_checks(Color c, Square ksq) const {
Square s; Square s;
Bitboard sliders, result = EmptyBoardBB; Bitboard sliders, result = EmptyBoardBB;
if (Piece == ROOK) // Resolved at compile time if (Piece == ROOK) // Resolved at compile time
sliders = rooks_and_queens(FindPinned ? opposite_color(c) : c) & RookPseudoAttacks[ksq]; sliders = rooks_and_queens(FindPinned ? opposite_color(c) : c) & RookPseudoAttacks[ksq];
else else
@ -338,7 +338,7 @@ Bitboard Position::hidden_checks(Color c, Square ksq) const {
// King blockers are candidate pinned pieces // King blockers are candidate pinned pieces
Bitboard candidate_pinned = piece_attacks<Piece>(ksq) & pieces_of_color(c); Bitboard candidate_pinned = piece_attacks<Piece>(ksq) & pieces_of_color(c);
// Pinners are sliders, not checkers, that give check when // Pinners are sliders, not checkers, that give check when
// candidate pinned are removed. // candidate pinned are removed.
Bitboard pinners = (FindPinned ? sliders & ~checkersBB : sliders); Bitboard pinners = (FindPinned ? sliders & ~checkersBB : sliders);
@ -410,7 +410,6 @@ bool Position::piece_attacks_square(Square f, Square t) const {
case WR: case BR: return piece_attacks_square<ROOK>(f, t); case WR: case BR: return piece_attacks_square<ROOK>(f, t);
case WQ: case BQ: return piece_attacks_square<QUEEN>(f, t); case WQ: case BQ: return piece_attacks_square<QUEEN>(f, t);
case WK: case BK: return piece_attacks_square<KING>(f, t); case WK: case BK: return piece_attacks_square<KING>(f, t);
default: return false;
} }
return false; return false;
} }
@ -564,14 +563,14 @@ bool Position::move_is_check(Move m, Bitboard dcCandidates) const {
switch (type_of_piece_on(from)) switch (type_of_piece_on(from))
{ {
case PAWN: case PAWN:
if (bit_is_set(pawn_attacks(them, ksq), to)) // Normal check? if (bit_is_set(pawn_attacks(them, ksq), to)) // Normal check?
return true; return true;
if ( bit_is_set(dcCandidates, from) // Discovered check? if ( bit_is_set(dcCandidates, from) // Discovered check?
&& (direction_between_squares(from, ksq) != direction_between_squares(to, ksq))) && (direction_between_squares(from, ksq) != direction_between_squares(to, ksq)))
return true; return true;
if (move_promotion(m)) // Promotion with check? if (move_promotion(m)) // Promotion with check?
{ {
Bitboard b = occupied_squares(); Bitboard b = occupied_squares();
@ -607,7 +606,7 @@ bool Position::move_is_check(Move m, Bitboard dcCandidates) const {
} }
return false; return false;
case KNIGHT: case KNIGHT:
return bit_is_set(dcCandidates, from) // Discovered check? return bit_is_set(dcCandidates, from) // Discovered check?
|| bit_is_set(piece_attacks<KNIGHT>(ksq), to); // Normal check? || bit_is_set(piece_attacks<KNIGHT>(ksq), to); // Normal check?
@ -621,7 +620,7 @@ bool Position::move_is_check(Move m, Bitboard dcCandidates) const {
case QUEEN: case QUEEN:
// Discovered checks are impossible! // Discovered checks are impossible!
assert(!bit_is_set(dcCandidates, from)); assert(!bit_is_set(dcCandidates, from));
return bit_is_set(piece_attacks<QUEEN>(ksq), to); // Normal check? return bit_is_set(piece_attacks<QUEEN>(ksq), to); // Normal check?
case KING: case KING:
@ -1337,7 +1336,6 @@ void Position::undo_castle_move(Move m) {
// Position::undo_move. In particular, the side to move has been switched, // Position::undo_move. In particular, the side to move has been switched,
// so the code below is correct. // so the code below is correct.
Color us = side_to_move(); Color us = side_to_move();
Color them = opposite_color(us);
// Find source squares for king and rook // Find source squares for king and rook
Square kfrom = move_from(m); Square kfrom = move_from(m);
@ -1396,7 +1394,7 @@ void Position::undo_castle_move(Move m) {
/// Position::do_move, is used to put back the captured piece (if any). /// Position::do_move, is used to put back the captured piece (if any).
void Position::undo_promotion_move(Move m, const UndoInfo &u) { void Position::undo_promotion_move(Move m, const UndoInfo &u) {
Color us, them; Color us, them;
Square from, to; Square from, to;
PieceType capture, promotion; PieceType capture, promotion;
@ -2256,7 +2254,7 @@ bool Position::is_ok(int* failedStep) const {
{ {
if (mgValue != compute_mg_value()) if (mgValue != compute_mg_value())
return false; return false;
if (egValue != compute_eg_value()) if (egValue != compute_eg_value())
return false; return false;
} }