Skip to content

Commit 64d29a6

Browse files
committed
Sync some common names
No functional change.
1 parent fcf2a34 commit 64d29a6

13 files changed

Lines changed: 81 additions & 81 deletions

src/bitboard.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ const std::string Bitboards::pretty(Bitboard b) {
131131

132132
std::string s = "+---+---+---+---+---+---+---+---+\n";
133133

134-
for (Rank rank = RANK_8; rank >= RANK_1; --rank)
134+
for (Rank r = RANK_8; r >= RANK_1; --r)
135135
{
136-
for (File file = FILE_A; file <= FILE_H; ++file)
137-
s.append(b & make_square(file, rank) ? "| X " : "| ");
136+
for (File f = FILE_A; f <= FILE_H; ++f)
137+
s.append(b & make_square(f, r) ? "| X " : "| ");
138138

139139
s.append("|\n+---+---+---+---+---+---+---+---+\n");
140140
}

src/bitboard.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,14 @@ inline Bitboard attacks_bb(Square s, Bitboard occ) {
254254
return (Pt == ROOK ? RAttacks : BAttacks)[s][magic_index<Pt>(s, occ)];
255255
}
256256

257-
inline Bitboard attacks_bb(Piece p, Square s, Bitboard occ) {
257+
inline Bitboard attacks_bb(Piece pc, Square s, Bitboard occ) {
258258

259-
switch (type_of(p))
259+
switch (type_of(pc))
260260
{
261261
case BISHOP: return attacks_bb<BISHOP>(s, occ);
262262
case ROOK : return attacks_bb<ROOK>(s, occ);
263263
case QUEEN : return attacks_bb<BISHOP>(s, occ) | attacks_bb<ROOK>(s, occ);
264-
default : return StepAttacksBB[p][s];
264+
default : return StepAttacksBB[pc][s];
265265
}
266266
}
267267

@@ -273,15 +273,15 @@ inline Bitboard attacks_bb(Piece p, Square s, Bitboard occ) {
273273
# if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
274274

275275
FORCE_INLINE Square lsb(Bitboard b) {
276-
unsigned long index;
277-
_BitScanForward64(&index, b);
278-
return (Square) index;
276+
unsigned long idx;
277+
_BitScanForward64(&idx, b);
278+
return (Square) idx;
279279
}
280280

281281
FORCE_INLINE Square msb(Bitboard b) {
282-
unsigned long index;
283-
_BitScanReverse64(&index, b);
284-
return (Square) index;
282+
unsigned long idx;
283+
_BitScanReverse64(&idx, b);
284+
return (Square) idx;
285285
}
286286

287287
# elif defined(__arm__)
@@ -302,15 +302,15 @@ FORCE_INLINE Square lsb(Bitboard b) {
302302
# else
303303

304304
FORCE_INLINE Square lsb(Bitboard b) { // Assembly code by Heinz van Saanen
305-
Bitboard index;
306-
__asm__("bsfq %1, %0": "=r"(index): "rm"(b) );
307-
return (Square) index;
305+
Bitboard idx;
306+
__asm__("bsfq %1, %0": "=r"(idx): "rm"(b) );
307+
return (Square) idx;
308308
}
309309

310310
FORCE_INLINE Square msb(Bitboard b) {
311-
Bitboard index;
312-
__asm__("bsrq %1, %0": "=r"(index): "rm"(b) );
313-
return (Square) index;
311+
Bitboard idx;
312+
__asm__("bsrq %1, %0": "=r"(idx): "rm"(b) );
313+
return (Square) idx;
314314
}
315315

316316
# endif

src/book.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,10 @@ namespace {
326326
while (b)
327327
{
328328
Square s = pop_lsb(&b);
329-
Piece p = pos.piece_on(s);
329+
Piece pc = pos.piece_on(s);
330330

331331
// PolyGlot pieces are: BP = 0, WP = 1, BN = 2, ... BK = 10, WK = 11
332-
key ^= PG.Zobrist.psq[2 * (type_of(p) - 1) + (color_of(p) == WHITE)][s];
332+
key ^= PG.Zobrist.psq[2 * (type_of(pc) - 1) + (color_of(pc) == WHITE)][s];
333333
}
334334

335335
b = pos.can_castle(ANY_CASTLING);

src/material.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct Entry {
4242
Score space_weight() const { return spaceWeight; }
4343
Phase game_phase() const { return gamePhase; }
4444
bool specialized_eval_exists() const { return evaluationFunction != NULL; }
45-
Value evaluate(const Position& p) const { return (*evaluationFunction)(p); }
45+
Value evaluate(const Position& pos) const { return (*evaluationFunction)(pos); }
4646
ScaleFactor scale_factor(const Position& pos, Color c) const;
4747

4848
Key key;

src/misc.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,22 @@ const string engine_info(bool to_uci) {
4040

4141
const string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
4242
string month, day, year;
43-
stringstream s, date(__DATE__); // From compiler, format is "Sep 21 2008"
43+
stringstream ss, date(__DATE__); // From compiler, format is "Sep 21 2008"
4444

45-
s << "Stockfish " << Version << setfill('0');
45+
ss << "Stockfish " << Version << setfill('0');
4646

4747
if (Version.empty())
4848
{
4949
date >> month >> day >> year;
50-
s << setw(2) << day << setw(2) << (1 + months.find(month) / 4) << year.substr(2);
50+
ss << setw(2) << day << setw(2) << (1 + months.find(month) / 4) << year.substr(2);
5151
}
5252

53-
s << (Is64Bit ? " 64" : "")
54-
<< (HasPopCnt ? " SSE4.2" : "")
55-
<< (to_uci ? "\nid author ": " by ")
56-
<< "Tord Romstad, Marco Costalba and Joona Kiiski";
53+
ss << (Is64Bit ? " 64" : "")
54+
<< (HasPopCnt ? " SSE4.2" : "")
55+
<< (to_uci ? "\nid author ": " by ")
56+
<< "Tord Romstad, Marco Costalba and Joona Kiiski";
5757

58-
return s.str();
58+
return ss.str();
5959
}
6060

6161

src/movepick.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
8181
followupmoves = fm;
8282
ss = s;
8383

84-
if (p.checkers())
84+
if (pos.checkers())
8585
stage = EVASION;
8686

8787
else
@@ -92,11 +92,11 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
9292
}
9393

9494
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h,
95-
Square sq) : pos(p), history(h), cur(moves), end(moves) {
95+
Square s) : pos(p), history(h), cur(moves), end(moves) {
9696

9797
assert(d <= DEPTH_ZERO);
9898

99-
if (p.checkers())
99+
if (pos.checkers())
100100
stage = EVASION;
101101

102102
else if (d > DEPTH_QS_NO_CHECKS)
@@ -115,7 +115,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
115115
else
116116
{
117117
stage = RECAPTURE;
118-
recaptureSquare = sq;
118+
recaptureSquare = s;
119119
ttm = MOVE_NONE;
120120
}
121121

src/movepick.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,25 @@ struct Stats {
4242

4343
static const Value Max = Value(2000);
4444

45-
const T* operator[](Piece p) const { return table[p]; }
45+
const T* operator[](Piece pc) const { return table[pc]; }
4646
void clear() { std::memset(table, 0, sizeof(table)); }
4747

48-
void update(Piece p, Square to, Move m) {
48+
void update(Piece pc, Square to, Move m) {
4949

50-
if (m == table[p][to].first)
50+
if (m == table[pc][to].first)
5151
return;
5252

53-
table[p][to].second = table[p][to].first;
54-
table[p][to].first = m;
53+
table[pc][to].second = table[pc][to].first;
54+
table[pc][to].first = m;
5555
}
5656

57-
void update(Piece p, Square to, Value v) {
57+
void update(Piece pc, Square to, Value v) {
5858

5959
if (Gain)
60-
table[p][to] = std::max(v, table[p][to] - 1);
60+
table[pc][to] = std::max(v, table[pc][to] - 1);
6161

62-
else if (abs(table[p][to] + v) < Max)
63-
table[p][to] += v;
62+
else if (abs(table[pc][to] + v) < Max)
63+
table[pc][to] += v;
6464
}
6565

6666
private:

src/notation.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ const string move_to_san(Position& pos, Move m) {
132132

133133
while (b)
134134
{
135-
Square sq = pop_lsb(&b);
136-
if (!pos.legal(make_move(sq, to), pos.pinned_pieces(us)))
137-
others ^= sq;
135+
Square s = pop_lsb(&b);
136+
if (!pos.legal(make_move(s, to), pos.pinned_pieces(us)))
137+
others ^= s;
138138
}
139139

140140
if (!others)

src/position.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -388,21 +388,21 @@ const string Position::fen() const {
388388
int emptyCnt;
389389
std::ostringstream ss;
390390

391-
for (Rank rank = RANK_8; rank >= RANK_1; --rank)
391+
for (Rank r = RANK_8; r >= RANK_1; --r)
392392
{
393-
for (File file = FILE_A; file <= FILE_H; ++file)
393+
for (File f = FILE_A; f <= FILE_H; ++f)
394394
{
395-
for (emptyCnt = 0; file <= FILE_H && empty(make_square(file, rank)); ++file)
395+
for (emptyCnt = 0; f <= FILE_H && empty(make_square(f, r)); ++f)
396396
++emptyCnt;
397397

398398
if (emptyCnt)
399399
ss << emptyCnt;
400400

401-
if (file <= FILE_H)
402-
ss << PieceToChar[piece_on(make_square(file, rank))];
401+
if (f <= FILE_H)
402+
ss << PieceToChar[piece_on(make_square(f, r))];
403403
}
404404

405-
if (rank > RANK_1)
405+
if (r > RANK_1)
406406
ss << '/';
407407
}
408408

@@ -433,7 +433,7 @@ const string Position::fen() const {
433433
/// Position::pretty() returns an ASCII representation of the position to be
434434
/// printed to the standard output together with the move's san notation.
435435

436-
const string Position::pretty(Move move) const {
436+
const string Position::pretty(Move m) const {
437437

438438
const string dottedLine = "\n+---+---+---+---+---+---+---+---+";
439439
const string twoRows = dottedLine + "\n| | . | | . | | . | | . |"
@@ -449,9 +449,9 @@ const string Position::pretty(Move move) const {
449449

450450
std::ostringstream ss;
451451

452-
if (move)
452+
if (m)
453453
ss << "\nMove: " << (sideToMove == BLACK ? ".." : "")
454-
<< move_to_san(*const_cast<Position*>(this), move);
454+
<< move_to_san(*const_cast<Position*>(this), m);
455455

456456
ss << brd << "\nFen: " << fen() << "\nKey: " << std::hex << std::uppercase
457457
<< std::setfill('0') << std::setw(16) << st->key << "\nCheckers: ";
@@ -1147,9 +1147,9 @@ void Position::flip() {
11471147
string f, token;
11481148
std::stringstream ss(fen());
11491149

1150-
for (Rank rank = RANK_8; rank >= RANK_1; --rank) // Piece placement
1150+
for (Rank r = RANK_8; r >= RANK_1; --r) // Piece placement
11511151
{
1152-
std::getline(ss, token, rank > RANK_1 ? '/' : ' ');
1152+
std::getline(ss, token, r > RANK_1 ? '/' : ' ');
11531153
f.insert(0, token + (f.empty() ? " " : "/"));
11541154
}
11551155

src/position.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const size_t StateCopySize64 = offsetof(StateInfo, key) / sizeof(uint64_t) + 1;
7575
class Position {
7676
public:
7777
Position() {}
78-
Position(const Position& p, Thread* t) { *this = p; thisThread = t; }
78+
Position(const Position& pos, Thread* t) { *this = pos; thisThread = t; }
7979
Position(const std::string& f, bool c960, Thread* t) { set(f, c960, t); }
8080
Position& operator=(const Position&);
8181
static void init();
@@ -113,7 +113,7 @@ class Position {
113113
// Attacks to/from a given square
114114
Bitboard attackers_to(Square s) const;
115115
Bitboard attackers_to(Square s, Bitboard occ) const;
116-
Bitboard attacks_from(Piece p, Square s) const;
116+
Bitboard attacks_from(Piece pc, Square s) const;
117117
template<PieceType> Bitboard attacks_from(Square s) const;
118118
template<PieceType> Bitboard attacks_from(Square s, Color c) const;
119119

@@ -295,8 +295,8 @@ inline Bitboard Position::attacks_from<PAWN>(Square s, Color c) const {
295295
return StepAttacksBB[make_piece(c, PAWN)][s];
296296
}
297297

298-
inline Bitboard Position::attacks_from(Piece p, Square s) const {
299-
return attacks_bb(p, s, byTypeBB[ALL_PIECES]);
298+
inline Bitboard Position::attacks_from(Piece pc, Square s) const {
299+
return attacks_bb(pc, s, byTypeBB[ALL_PIECES]);
300300
}
301301

302302
inline Bitboard Position::attackers_to(Square s) const {

0 commit comments

Comments
 (0)