Skip to content

Commit 40cb0f0

Browse files
Lolligerhanssnicolet
authored andcommitted
Small trivial clean-ups, February 2021
Closes #3329 No functional change
1 parent b46813f commit 40cb0f0

File tree

5 files changed

+19
-21
lines changed

5 files changed

+19
-21
lines changed

src/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Stockfish, a UCI chess playing engine derived from Glaurung 2.1
2-
# Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
3-
# Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
4-
# Copyright (C) 2015-2019 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
2+
# Copyright (C) 2004-2021 The Stockfish developers (see AUTHORS file)
53
#
64
# Stockfish is free software: you can redistribute it and/or modify
75
# it under the terms of the GNU General Public License as published by

src/evaluate.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ namespace {
423423
score += BishopOnKingRing;
424424

425425
int mob = popcount(b & mobilityArea[Us]);
426-
427426
mobility[Us] += MobilityBonus[Pt - 2][mob];
428427

429428
if (Pt == BISHOP || Pt == KNIGHT)

src/movepick.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ void MovePicker::score() {
9999
static_assert(Type == CAPTURES || Type == QUIETS || Type == EVASIONS, "Wrong type");
100100

101101
for (auto& m : *this)
102-
if (Type == CAPTURES)
102+
if constexpr (Type == CAPTURES)
103103
m.value = int(PieceValue[MG][pos.piece_on(to_sq(m))]) * 6
104104
+ (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))];
105105

106-
else if (Type == QUIETS)
106+
else if constexpr (Type == QUIETS)
107107
m.value = (*mainHistory)[pos.side_to_move()][from_to(m)]
108108
+ 2 * (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)]
109109
+ (*continuationHistory[1])[pos.moved_piece(m)][to_sq(m)]

src/position.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ Position& Position::set(const string& fenStr, bool isChess960, StateInfo* si, Th
268268
enpassant = pawn_attacks_bb(~sideToMove, st->epSquare) & pieces(sideToMove, PAWN)
269269
&& (pieces(~sideToMove, PAWN) & (st->epSquare + pawn_push(~sideToMove)))
270270
&& !(pieces() & (st->epSquare | (st->epSquare + pawn_push(sideToMove))))
271-
&& (file_of(square<KING>(sideToMove)) == file_of(st->epSquare)
272-
|| !(blockers_for_king(sideToMove) & (st->epSquare + pawn_push(~sideToMove))));
271+
&& ( file_of(square<KING>(sideToMove)) == file_of(st->epSquare)
272+
|| !(blockers_for_king(sideToMove) & (st->epSquare + pawn_push(~sideToMove))));
273273
}
274274

275275
// It's necessary for st->previous to be intialized in this way because legality check relies on its existence
@@ -518,8 +518,8 @@ bool Position::legal(Move m) const {
518518
// st->previous->blockersForKing consider capsq as empty.
519519
// If pinned, it has to move along the king ray.
520520
if (type_of(m) == EN_PASSANT)
521-
return !(st->previous->blockersForKing[sideToMove] & from) ||
522-
aligned(from, to, square<KING>(us));
521+
return !(st->previous->blockersForKing[sideToMove] & from)
522+
|| aligned(from, to, square<KING>(us));
523523

524524
// Castling moves generation does not check if the castling path is clear of
525525
// enemy attacks, it is delayed at a later time: now!
@@ -546,8 +546,8 @@ bool Position::legal(Move m) const {
546546

547547
// A non-king move is legal if and only if it is not pinned or it
548548
// is moving along the ray towards or away from the king.
549-
return !(blockers_for_king(us) & from)
550-
|| aligned(from, to, square<KING>(us));
549+
return !(blockers_for_king(us) & from)
550+
|| aligned(from, to, square<KING>(us));
551551
}
552552

553553

@@ -657,8 +657,9 @@ bool Position::gives_check(Move m) const {
657657
// So the King must be in the same rank as fromsq to consider this possibility.
658658
// st->previous->blockersForKing consider capsq as empty.
659659
case EN_PASSANT:
660-
return st->previous->checkersBB || (rank_of(square<KING>(~sideToMove)) == rank_of(from)
661-
&& st->previous->blockersForKing[~sideToMove] & from);
660+
return st->previous->checkersBB
661+
|| ( rank_of(square<KING>(~sideToMove)) == rank_of(from)
662+
&& st->previous->blockersForKing[~sideToMove] & from);
662663

663664
default: //CASTLING
664665
{

src/search.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,12 +1025,12 @@ namespace {
10251025
movedPiece = pos.moved_piece(move);
10261026
givesCheck = pos.gives_check(move);
10271027

1028-
// Indicate PvNodes that will probably fail low if node was searched with non-PV search
1028+
// Indicate PvNodes that will probably fail low if node was searched with non-PV search
10291029
// at depth equal or greater to current depth and result of this search was far below alpha
1030-
bool likelyFailLow = PvNode
1031-
&& ttMove
1032-
&& (tte->bound() & BOUND_UPPER)
1033-
&& ttValue < alpha + 200 + 100 * depth
1030+
bool likelyFailLow = PvNode
1031+
&& ttMove
1032+
&& (tte->bound() & BOUND_UPPER)
1033+
&& ttValue < alpha + 200 + 100 * depth
10341034
&& tte->depth() >= depth;
10351035

10361036
// Calculate new depth for this move
@@ -1180,8 +1180,8 @@ namespace {
11801180
if (th.marked())
11811181
r++;
11821182

1183-
// Decrease reduction if position is or has been on the PV
1184-
// and node is not likely to fail low (~10 Elo)
1183+
// Decrease reduction if position is or has been on the PV
1184+
// and node is not likely to fail low. (~10 Elo)
11851185
if (ss->ttPv && !likelyFailLow)
11861186
r -= 2;
11871187

0 commit comments

Comments
 (0)