From: Alain SAVARD Date: Sun, 11 Jun 2017 21:31:15 +0000 (-0400) Subject: Misc coding style fixes X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=2c237da54647bb7526f3512bea183eb44919cdda;hp=b73016bb41d4c2fad3126b2e0018d71a36e78331 Misc coding style fixes a few comment and blank fixes. No functional change Closes #1141 --- diff --git a/src/bitboard.h b/src/bitboard.h index 38870a2b..63f668b9 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -186,7 +186,7 @@ inline Bitboard forward_bb(Color c, Square s) { /// pawn_attack_span() returns a bitboard representing all the squares that can be /// attacked by a pawn of the given color when it moves along its file, starting /// from the given square: -/// PawnAttackSpan[c][s] = in_front_bb(c, rank_of(s)) & adjacent_files_bb(s); +/// PawnAttackSpan[c][s] = in_front_bb(c, rank_of(s)) & adjacent_files_bb(file_of(s)); inline Bitboard pawn_attack_span(Color c, Square s) { return PawnAttackSpan[c][s]; @@ -251,7 +251,7 @@ inline Bitboard attacks_bb(PieceType pt, Square s, Bitboard occupied) { switch (pt) { case BISHOP: return attacks_bb(s, occupied); - case ROOK : return attacks_bb(s, occupied); + case ROOK : return attacks_bb< ROOK>(s, occupied); case QUEEN : return attacks_bb(s, occupied) | attacks_bb(s, occupied); default : return PseudoAttacks[pt][s]; } diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 3ba219cb..b0bebce6 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -154,7 +154,7 @@ namespace { }; const Score ThreatByRook[PIECE_TYPE_NB] = { - S(0, 0), S(0, 25), S(40, 62), S(40, 59), S( 0, 34), S(35, 48) + S(0, 0), S(0, 25), S(40, 62), S(40, 59), S(0, 34), S(35, 48) }; // ThreatByKing[on one/on many] contains bonuses for king attacks on @@ -433,7 +433,7 @@ namespace { safe = ~pos.pieces(Them); safe &= ~ei.attackedBy[Us][ALL_PIECES] | (undefended & ei.attackedBy2[Them]); - b1 = pos.attacks_from(ksq); + b1 = pos.attacks_from< ROOK>(ksq); b2 = pos.attacks_from(ksq); // Enemy queen safe checks @@ -632,7 +632,7 @@ namespace { // Adjust bonus based on the king's proximity ebonus += distance(pos.square(Them), blockSq) * 5 * rr - - distance(pos.square(Us ), blockSq) * 2 * rr; + - distance(pos.square( Us), blockSq) * 2 * rr; // If blockSq is not the queening square then consider also a second push if (relative_rank(Us, blockSq) != RANK_8) diff --git a/src/pawns.cpp b/src/pawns.cpp index dab280cc..0f6430b9 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -105,7 +105,7 @@ namespace { Score score = SCORE_ZERO; const Square* pl = pos.squares(Us); - Bitboard ourPawns = pos.pieces(Us , PAWN); + Bitboard ourPawns = pos.pieces( Us, PAWN); Bitboard theirPawns = pos.pieces(Them, PAWN); e->passedPawns[Us] = e->pawnAttacksSpan[Us] = 0; diff --git a/src/position.cpp b/src/position.cpp index 4c8145c4..01f51ed0 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -477,7 +477,7 @@ Bitboard Position::slider_blockers(Bitboard sliders, Square s, Bitboard& pinners pinners = 0; // Snipers are sliders that attack 's' when a piece is removed - Bitboard snipers = ( (PseudoAttacks[ROOK ][s] & pieces(QUEEN, ROOK)) + Bitboard snipers = ( (PseudoAttacks[ ROOK][s] & pieces(QUEEN, ROOK)) | (PseudoAttacks[BISHOP][s] & pieces(QUEEN, BISHOP))) & sliders; while (snipers) @@ -504,7 +504,7 @@ Bitboard Position::attackers_to(Square s, Bitboard occupied) const { return (attacks_from(s, BLACK) & pieces(WHITE, PAWN)) | (attacks_from(s, WHITE) & pieces(BLACK, PAWN)) | (attacks_from(s) & pieces(KNIGHT)) - | (attacks_bb(s, occupied) & pieces(ROOK, QUEEN)) + | (attacks_bb< ROOK>(s, occupied) & pieces( ROOK, QUEEN)) | (attacks_bb(s, occupied) & pieces(BISHOP, QUEEN)) | (attacks_from(s) & pieces(KING)); } diff --git a/src/search.cpp b/src/search.cpp index aafe82a9..d59edbae 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -85,7 +85,7 @@ namespace { // History and stats update bonus, based on depth int stat_bonus(Depth depth) { - int d = depth / ONE_PLY ; + int d = depth / ONE_PLY; return d > 17 ? 0 : d * d + 2 * d - 2; } diff --git a/src/syzygy/tbprobe.cpp b/src/syzygy/tbprobe.cpp index 48c448fd..0805975b 100644 --- a/src/syzygy/tbprobe.cpp +++ b/src/syzygy/tbprobe.cpp @@ -673,7 +673,7 @@ int map_score(DTZEntry* entry, File f, int value, WDLScore wdl) { // idx = Binomial[1][s1] + Binomial[2][s2] + ... + Binomial[k][sk] // template::type> -T do_probe_table(const Position& pos, Entry* entry, WDLScore wdl, ProbeState* result) { +T do_probe_table(const Position& pos, Entry* entry, WDLScore wdl, ProbeState* result) { const bool IsWDL = std::is_same::value; @@ -1107,7 +1107,7 @@ void do_init(Entry& e, T& p, uint8_t* data) { for (File f = FILE_A; f <= MaxFile; ++f) for (int i = 0; i < Sides; i++) { (d = item(p, i, f).precomp)->sparseIndex = (SparseEntry*)data; - data += d->sparseIndexSize * sizeof(SparseEntry) ; + data += d->sparseIndexSize * sizeof(SparseEntry); } for (File f = FILE_A; f <= MaxFile; ++f)