From: Marco Costalba Date: Fri, 14 Feb 2014 08:42:50 +0000 (+0100) Subject: Additional renaming from DON X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=e4695f15bc62c0e34572b3a995e25b7461d2ae90 Additional renaming from DON Assorted renaming and triviality. No functional change. --- diff --git a/src/bitbase.cpp b/src/bitbase.cpp index dbda28e0..cd6a7329 100644 --- a/src/bitbase.cpp +++ b/src/bitbase.cpp @@ -26,10 +26,10 @@ namespace { // There are 24 possible pawn squares: the first 4 files and ranks from 2 to 7 - const unsigned IndexMax = 2*24*64*64; // stm * psq * wksq * bksq = 196608 + const unsigned MAX_INDEX = 2*24*64*64; // stm * psq * wksq * bksq = 196608 // Each uint32_t stores results of 32 positions, one per bit - uint32_t KPKBitbase[IndexMax / 32]; + uint32_t KPKBitbase[MAX_INDEX / 32]; // A KPK bitbase index is an integer in [0, IndexMax] range // @@ -84,20 +84,20 @@ void Bitbases::init_kpk() { unsigned idx, repeat = 1; std::vector db; - db.reserve(IndexMax); + db.reserve(MAX_INDEX); // Initialize db with known win / draw positions - for (idx = 0; idx < IndexMax; ++idx) + for (idx = 0; idx < MAX_INDEX; ++idx) db.push_back(KPKPosition(idx)); // Iterate through the positions until none of the unknown positions can be // changed to either wins or draws (15 cycles needed). while (repeat) - for (repeat = idx = 0; idx < IndexMax; ++idx) + for (repeat = idx = 0; idx < MAX_INDEX; ++idx) repeat |= (db[idx] == UNKNOWN && db[idx].classify(db) != UNKNOWN); // Map 32 results into one KPKBitbase[] entry - for (idx = 0; idx < IndexMax; ++idx) + for (idx = 0; idx < MAX_INDEX; ++idx) if (db[idx] == WIN) KPKBitbase[idx / 32] |= 1 << (idx & 0x1F); } diff --git a/src/misc.h b/src/misc.h index c4232a48..92bde8f0 100644 --- a/src/misc.h +++ b/src/misc.h @@ -51,11 +51,11 @@ namespace Time { template struct HashTable { - HashTable() : e(Size, Entry()) {} - Entry* operator[](Key k) { return &e[(uint32_t)k & (Size - 1)]; } + HashTable() : table(Size, Entry()) {} + Entry* operator[](Key k) { return &table[(uint32_t)k & (Size - 1)]; } private: - std::vector e; + std::vector table; }; diff --git a/src/movegen.cpp b/src/movegen.cpp index ef9a2727..30665ee0 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -46,10 +46,10 @@ namespace { assert(!pos.checkers()); - const int K = Chess960 ? kto > kfrom ? -1 : 1 - : Side == KING_SIDE ? -1 : 1; + const Square K = Chess960 ? kto > kfrom ? DELTA_W : DELTA_E + : Side == KING_SIDE ? DELTA_W : DELTA_E; - for (Square s = kto; s != kfrom; s += (Square)K) + for (Square s = kto; s != kfrom; s += K) if (pos.attackers_to(s) & enemies) return mlist; diff --git a/src/movepick.cpp b/src/movepick.cpp index 41b85f07..09f7611c 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -210,10 +210,10 @@ void MovePicker::score() { } -/// generate_next() generates, scores and sorts the next bunch of moves, when -/// there are no more moves to try for the current phase. +/// generate_next_stage() generates, scores and sorts the next bunch of moves, +/// when there are no more moves to try for the current stage. -void MovePicker::generate_next() { +void MovePicker::generate_next_stage() { cur = moves; @@ -305,7 +305,7 @@ Move MovePicker::next_move() { while (true) { while (cur == end) - generate_next(); + generate_next_stage(); switch (stage) { diff --git a/src/movepick.h b/src/movepick.h index 21ea9ab3..c4676ca4 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -92,7 +92,7 @@ public: private: template void score(); - void generate_next(); + void generate_next_stage(); const Position& pos; const HistoryStats& history; diff --git a/src/types.h b/src/types.h index cae315a1..7a8d0b01 100644 --- a/src/types.h +++ b/src/types.h @@ -98,6 +98,7 @@ const int MAX_PLY_PLUS_6 = MAX_PLY + 6; /// bit 6-11: origin square (from 0 to 63) /// bit 12-13: promotion piece type - 2 (from KNIGHT-2 to QUEEN-2) /// bit 14-15: special move flag: promotion (1), en passant (2), castling (3) +/// NOTE: EN-PASSANT bit is set only when a pawn can be captured /// /// Special cases are MOVE_NONE and MOVE_NULL. We can sneak these in because in /// any normal move destination square is always different from origin square @@ -260,12 +261,12 @@ inline Value mg_value(Score s) { return Value(((s + 0x8000) & ~0xffff) / 0x10000 /// standard compliant, seems to work for Intel and MSVC. #if defined(IS_64BIT) && (!defined(__GNUC__) || defined(__INTEL_COMPILER)) -inline Value eg_value(Score s) { return Value(int16_t(s & 0xffff)); } +inline Value eg_value(Score s) { return Value(int16_t(s & 0xFFFF)); } #else inline Value eg_value(Score s) { - return Value((int)(unsigned(s) & 0x7fffu) - (int)(unsigned(s) & 0x8000u)); + return Value((int)(unsigned(s) & 0x7FFFU) - (int)(unsigned(s) & 0x8000U)); } #endif @@ -295,7 +296,7 @@ ENABLE_OPERATORS_ON(Square) ENABLE_OPERATORS_ON(File) ENABLE_OPERATORS_ON(Rank) -/// Added operators for adding integers to a Value +/// Additional operators to add integers to a Value inline Value operator+(Value v, int i) { return Value(int(v) + i); } inline Value operator-(Value v, int i) { return Value(int(v) - i); }