]> git.sesse.net Git - stockfish/commitdiff
Additional renaming from DON
authorMarco Costalba <mcostalba@gmail.com>
Fri, 14 Feb 2014 08:42:50 +0000 (09:42 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 14 Feb 2014 08:42:50 +0000 (09:42 +0100)
Assorted renaming and triviality.

No functional change.

src/bitbase.cpp
src/misc.h
src/movegen.cpp
src/movepick.cpp
src/movepick.h
src/types.h

index dbda28e0019cf9e161b826cd4130307f2db6cb97..cd6a7329724e4260bc1529ca9756e82b8265adb9 100644 (file)
 namespace {
 
   // There are 24 possible pawn squares: the first 4 files and ranks from 2 to 7
 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
 
   // 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
   //
 
   // 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<KPKPosition> db;
 
   unsigned idx, repeat = 1;
   std::vector<KPKPosition> db;
-  db.reserve(IndexMax);
+  db.reserve(MAX_INDEX);
 
   // Initialize db with known win / draw positions
 
   // 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)
       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
           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);
 }
       if (db[idx] == WIN)
           KPKBitbase[idx / 32] |= 1 << (idx & 0x1F);
 }
index c4232a48ce3c653e5e17c9d16e58d133c5a4315f..92bde8f00618f9a70b7871dd958c69b759182693 100644 (file)
@@ -51,11 +51,11 @@ namespace Time {
 
 template<class Entry, int Size>
 struct HashTable {
 
 template<class Entry, int Size>
 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:
 
 private:
-  std::vector<Entry> e;
+  std::vector<Entry> table;
 };
 
 
 };
 
 
index ef9a2727a5ac49f94b279652e222b5ee6c40a085..30665ee03b8e35c8c3a6fb73a898500aca9dc394 100644 (file)
@@ -46,10 +46,10 @@ namespace {
 
     assert(!pos.checkers());
 
 
     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;
 
         if (pos.attackers_to(s) & enemies)
             return mlist;
 
index 41b85f074ae0994a86c6615707ad03bb5be925b2..09f7611c527b8e397f6422c2901f7a48854726cd 100644 (file)
@@ -210,10 +210,10 @@ void MovePicker::score<EVASIONS>() {
 }
 
 
 }
 
 
-/// 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;
 
 
   cur = moves;
 
@@ -305,7 +305,7 @@ Move MovePicker::next_move<false>() {
   while (true)
   {
       while (cur == end)
   while (true)
   {
       while (cur == end)
-          generate_next();
+          generate_next_stage();
 
       switch (stage) {
 
 
       switch (stage) {
 
index 21ea9ab3e2292afc1835059cbdfaf8ed74128892..c4676ca4f6e9f5be4b50be4462f92a3286ee9412 100644 (file)
@@ -92,7 +92,7 @@ public:
 
 private:
   template<GenType> void score();
 
 private:
   template<GenType> void score();
-  void generate_next();
+  void generate_next_stage();
 
   const Position& pos;
   const HistoryStats& history;
 
   const Position& pos;
   const HistoryStats& history;
index cae315a150180a542569c57b7c3352ad54f1284b..7a8d0b019f19830b8c7ddfc05c66e6cdb1ace611 100644 (file)
@@ -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)
 /// 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
 ///
 /// 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))
 
 /// 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) {
 
 #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
 }
 
 #endif
@@ -295,7 +296,7 @@ ENABLE_OPERATORS_ON(Square)
 ENABLE_OPERATORS_ON(File)
 ENABLE_OPERATORS_ON(Rank)
 
 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); }
 
 inline Value operator+(Value v, int i) { return Value(int(v) + i); }
 inline Value operator-(Value v, int i) { return Value(int(v) - i); }