]> git.sesse.net Git - stockfish/commitdiff
Small codestyle touches
authorMarco Costalba <mcostalba@gmail.com>
Sat, 9 Oct 2010 12:05:58 +0000 (13:05 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 9 Oct 2010 12:05:58 +0000 (13:05 +0100)
Mostly suggested by Justin (UncombedCoconut), the 0ULL -> 0 conversion
is mine.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/bitboard.cpp
src/book.cpp
src/move.h
src/movegen.cpp
src/movepick.cpp
src/movepick.h
src/position.cpp
src/search.cpp
src/timeman.cpp
src/timeman.h

index 2b42ce019ddfdc2765009bfd91a0dfa68be95c76..e23e5b6bbb56447c404dccfaaf53190ed67ebe92 100644 (file)
@@ -403,7 +403,7 @@ namespace {
             AttackSpanMask[c][s] = in_front_bb(c, s) & neighboring_files_bb(s);
         }
 
-    for (Bitboard b = 0ULL; b < 256ULL; b++)
+    for (Bitboard b = 0; b < 256; b++)
         BitCount8Bit[b] = (uint8_t)count_1s<CNT32>(b);
   }
 
@@ -511,7 +511,7 @@ namespace {
     for (int i = 0, index = 0; i < 64; i++)
     {
         attackIndex[i] = index;
-        mask[i] = sliding_attacks(i, 0ULL, 4, deltas, 1, 6, 1, 6);
+        mask[i] = sliding_attacks(i, 0, 4, deltas, 1, 6, 1, 6);
 
 #if defined(IS_64BIT)
         int j = (1 << (64 - shift[i]));
index ad0d406d343d6b3889132a28c728727394ed5924..c9a2e9c973ee0f8f75baa893994194d110c567d7 100644 (file)
@@ -441,7 +441,7 @@ Move Book::get_move(const Position& pos, bool findBestMove) {
   if (!bookMove)
       return MOVE_NONE;
 
-  MoveStack mlist[256];
+  MoveStack mlist[MOVES_MAX];
   MoveStack* last = generate_moves(pos, mlist);
   for (MoveStack* cur = mlist; cur != last; cur++)
       if ((int(cur->move) & 07777) == bookMove)
@@ -515,7 +515,7 @@ uint64_t Book::read_integer(int size) {
   read(buf, size);
 
   // Numbers are stored on disk as a binary byte stream
-  uint64_t n = 0ULL;
+  uint64_t n = 0;
   for (int i = 0; i < size; i++)
       n = (n << 8) + (unsigned char)buf[i];
 
@@ -531,7 +531,7 @@ namespace {
 
   uint64_t book_key(const Position& pos) {
 
-    uint64_t result = 0ULL;
+    uint64_t result = 0;
 
     for (Color c = WHITE; c <= BLACK; c++)
     {
@@ -566,7 +566,7 @@ namespace {
 
   uint64_t book_castle_key(const Position& pos) {
 
-    uint64_t result = 0ULL;
+    uint64_t result = 0;
 
     if (pos.can_castle_kingside(WHITE))
         result ^= Random64[RandomCastle+0];
@@ -585,11 +585,11 @@ namespace {
 
 
   uint64_t book_ep_key(const Position& pos) {
-    return (pos.ep_square() == SQ_NONE ? 0ULL : Random64[RandomEnPassant + square_file(pos.ep_square())]);
+    return pos.ep_square() == SQ_NONE ? 0 : Random64[RandomEnPassant + square_file(pos.ep_square())];
   }
 
 
   uint64_t book_color_key(const Position& pos) {
-    return (pos.side_to_move() == WHITE ? Random64[RandomTurn] : 0ULL);
+    return pos.side_to_move() == WHITE ? Random64[RandomTurn] : 0;
   }
 }
index 9df3277db775919672a88923e991ee82ffbf707c..e2562a422ce7c92954293d40479953f5f7ecd37b 100644 (file)
@@ -31,6 +31,8 @@
 #include "piece.h"
 #include "square.h"
 
+// Maximum number of allowed moves per position
+const int MOVES_MAX = 256;
 
 ////
 //// Types
index ef080cc32b8154168745eba81623c50af6ddd239..076af3fe0c48b15b8dab329841c8dc3ef9f62624 100644 (file)
@@ -308,7 +308,7 @@ MoveStack* generate_moves(const Position& pos, MoveStack* mlist, bool pseudoLega
 
 bool move_is_legal(const Position& pos, const Move m) {
 
-  MoveStack mlist[256];
+  MoveStack mlist[MOVES_MAX];
   MoveStack *cur, *last = generate_moves(pos, mlist, true);
 
    for (cur = mlist; cur != last; cur++)
index c2b8924a962a3392e152582e799ff1b90b6a0001..2e8eb665b9acd04573c9e438d77212f2888ccff6 100644 (file)
@@ -75,7 +75,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
   int searchTT = ttm;
   ttMoves[0].move = ttm;
   badCaptureThreshold = 0;
-  badCaptures = moves + 256;
+  badCaptures = moves + MOVES_MAX;
 
   pinned = p.pinned_pieces(pos.side_to_move());
 
@@ -151,7 +151,7 @@ void MovePicker::go_next_phase() {
       // Bad captures SEE value is already calculated so just pick
       // them in order to get SEE move ordering.
       curMove = badCaptures;
-      lastMove = moves + 256;
+      lastMove = moves + MOVES_MAX;
       return;
 
   case PH_EVASIONS:
index 1a652d6fd69b44c7ce118a9ff11d07cacf6407b2..c71ff1a990f98879c842c483dfc67560039ed440 100644 (file)
@@ -66,7 +66,7 @@ private:
   int badCaptureThreshold, phase;
   const uint8_t* phasePtr;
   MoveStack *curMove, *lastMove, *lastGoodNonCapture, *badCaptures;
-  MoveStack moves[256];
+  MoveStack moves[MOVES_MAX];
 };
 
 
index 3b7916bf4b2e9cc4e1602c60c81e06d22fc9d3b5..74cb1f4eefef8c920ce7b1da55a70153fe9c08ca 100644 (file)
@@ -382,7 +382,7 @@ const string Position::to_fen() const {
 
 
 /// Position::print() prints an ASCII representation of the position to
-/// the standard output. If a move is given then also the san is print.
+/// the standard output. If a move is given then also the san is printed.
 
 void Position::print(Move move) const {
 
@@ -1561,7 +1561,7 @@ void Position::allow_ooo(Color c) {
 
 Key Position::compute_key() const {
 
-  Key result = Key(0ULL);
+  Key result = 0;
 
   for (Square s = SQ_A1; s <= SQ_H8; s++)
       if (square_is_occupied(s))
@@ -1586,7 +1586,7 @@ Key Position::compute_key() const {
 
 Key Position::compute_pawn_key() const {
 
-  Key result = Key(0ULL);
+  Key result = 0;
   Bitboard b;
   Square s;
 
@@ -1611,7 +1611,7 @@ Key Position::compute_pawn_key() const {
 
 Key Position::compute_material_key() const {
 
-  Key result = Key(0ULL);
+  Key result = 0;
   for (Color c = WHITE; c <= BLACK; c++)
       for (PieceType pt = PAWN; pt <= QUEEN; pt++)
       {
@@ -1703,7 +1703,7 @@ bool Position::is_draw() const {
 
 bool Position::is_mate() const {
 
-  MoveStack moves[256];
+  MoveStack moves[MOVES_MAX];
   return is_check() && (generate_moves(*this, moves) == moves);
 }
 
@@ -1713,7 +1713,7 @@ bool Position::is_mate() const {
 
 bool Position::has_mate_threat() {
 
-  MoveStack mlist[256], *last, *cur;
+  MoveStack mlist[MOVES_MAX], *last, *cur;
   StateInfo st1, st2;
   bool mateFound = false;
 
index 24c741aa1cad237909e561f595335f9f9b52d015..d54794bbc8712205a066cf977da4f692b3cb4c02 100644 (file)
@@ -52,9 +52,6 @@ using std::endl;
 
 namespace {
 
-  // Maximum number of allowed moves per position
-  const int MOVES_MAX = 256;
-
   // Types
   enum NodeType { NonPV, PV };
 
@@ -633,7 +630,7 @@ namespace {
 
             // Add some extra time if the best move has changed during the last two iterations
             if (Iteration > 5 && Iteration <= 50)
-                TimeMgr.pv_unstability(BestMoveChangesByIteration[Iteration],
+                TimeMgr.pv_instability(BestMoveChangesByIteration[Iteration],
                                        BestMoveChangesByIteration[Iteration-1]);
 
             // Stop search if most of MaxSearchTime is consumed at the end of the
index 64861feb0d61b741e03e07415ecef9bed0d0306f..e05c4626f31723c65593c6f995306708414de99a 100644 (file)
@@ -88,7 +88,7 @@ namespace {
 //// Functions
 ////
 
-void TimeManager::pv_unstability(int curChanges, int prevChanges) {
+void TimeManager::pv_instability(int curChanges, int prevChanges) {
 
     unstablePVExtraTime =  curChanges  * (optimumSearchTime / 2)
                          + prevChanges * (optimumSearchTime / 3);
index 1c28f7dbe674342af2498d87cd9d223fd909c44d..1d001c61ceeb05890b7b45303018706a0f9bf8fb 100644 (file)
@@ -29,7 +29,7 @@ class TimeManager {
 public:
 
   void init(int myTime, int myInc, int movesToGo, int currentPly);
-  void pv_unstability(int curChanges, int prevChanges);
+  void pv_instability(int curChanges, int prevChanges);
   int available_time() const { return optimumSearchTime + unstablePVExtraTime; }
   int maximum_time() const { return maximumSearchTime; }