]> git.sesse.net Git - stockfish/commitdiff
Minor code style tweaks
authorDU-jdto <jadto@outlook.com>
Mon, 16 Jul 2018 20:53:50 +0000 (06:53 +1000)
committerStéphane Nicolet <cassio@free.fr>
Wed, 18 Jul 2018 06:26:33 +0000 (08:26 +0200)
No functional change.

src/bitboard.cpp
src/search.cpp
src/types.h
src/uci.h
src/ucioption.cpp

index 96f0517f12f223a7558f6f27ef749da6aa22602c..b3aeed854b70ce656fda25215c213967b3b6ddcc 100644 (file)
@@ -137,7 +137,7 @@ void Bitboards::init() {
                   }
               }
 
                   }
               }
 
-  Direction RookDirections[] = { NORTH,  EAST,  SOUTH,  WEST };
+  Direction RookDirections[] = { NORTH, EAST, SOUTH, WEST };
   Direction BishopDirections[] = { NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST };
 
   init_magics(RookTable, RookMagics, RookDirections);
   Direction BishopDirections[] = { NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST };
 
   init_magics(RookTable, RookMagics, RookDirections);
index 7cb53fbf32064a53ff69cd97e774c56233dcd32e..9a826d3724dc43bc7e6e8bff935f064ac18d5104 100644 (file)
@@ -1239,8 +1239,8 @@ moves_loop: // When in check, search starts from here
         && ttHit
         && tte->depth() >= ttDepth
         && ttValue != VALUE_NONE // Only in case of TT access race
         && ttHit
         && tte->depth() >= ttDepth
         && ttValue != VALUE_NONE // Only in case of TT access race
-        && (ttValue >= beta ? (tte->bound() &  BOUND_LOWER)
-                            : (tte->bound() &  BOUND_UPPER)))
+        && (ttValue >= beta ? (tte->bound() & BOUND_LOWER)
+                            : (tte->bound() & BOUND_UPPER)))
         return ttValue;
 
     // Evaluate the position statically
         return ttValue;
 
     // Evaluate the position statically
@@ -1258,7 +1258,7 @@ moves_loop: // When in check, search starts from here
                 ss->staticEval = bestValue = evaluate(pos);
 
             // Can ttValue be used as a better position evaluation?
                 ss->staticEval = bestValue = evaluate(pos);
 
             // Can ttValue be used as a better position evaluation?
-            if (   ttValue != VALUE_NONE
+            if (    ttValue != VALUE_NONE
                 && (tte->bound() & (ttValue > bestValue ? BOUND_LOWER : BOUND_UPPER)))
                 bestValue = ttValue;
         }
                 && (tte->bound() & (ttValue > bestValue ? BOUND_LOWER : BOUND_UPPER)))
                 bestValue = ttValue;
         }
index ab5e1b884864108912de21d311a02fe14e5afb5a..175bbbeb40b33fb74c67b62b48d3160d81269371 100644 (file)
@@ -324,10 +324,10 @@ inline Value& operator+=(Value& v, int i) { return v = v + i; }
 inline Value& operator-=(Value& v, int i) { return v = v - i; }
 
 /// Additional operators to add a Direction to a Square
 inline Value& operator-=(Value& v, int i) { return v = v - i; }
 
 /// Additional operators to add a Direction to a Square
-inline Square operator+(Square s, Direction d) { return Square(int(s) + int(d)); }
-inline Square operator-(Square s, Direction d) { return Square(int(s) - int(d)); }
-inline Square& operator+=(Square &s, Direction d) { return s = s + d; }
-inline Square& operator-=(Square &s, Direction d) { return s = s - d; }
+constexpr Square operator+(Square s, Direction d) { return Square(int(s) + int(d)); }
+constexpr Square operator-(Square s, Direction d) { return Square(int(s) - int(d)); }
+inline Square& operator+=(Squares, Direction d) { return s = s + d; }
+inline Square& operator-=(Squares, Direction d) { return s = s - d; }
 
 /// Only declared but not defined. We don't want to multiply two scores due to
 /// a very high risk of overflow. So user should explicitly convert to integer.
 
 /// Only declared but not defined. We don't want to multiply two scores due to
 /// a very high risk of overflow. So user should explicitly convert to integer.
@@ -345,7 +345,7 @@ inline Score operator*(Score s, int i) {
 
   assert(eg_value(result) == (i * eg_value(s)));
   assert(mg_value(result) == (i * mg_value(s)));
 
   assert(eg_value(result) == (i * eg_value(s)));
   assert(mg_value(result) == (i * mg_value(s)));
-  assert((i == 0) || (result / i) == s );
+  assert((i == 0) || (result / i) == s);
 
   return result;
 }
 
   return result;
 }
@@ -448,7 +448,7 @@ constexpr PieceType promotion_type(Move m) {
   return PieceType(((m >> 12) & 3) + KNIGHT);
 }
 
   return PieceType(((m >> 12) & 3) + KNIGHT);
 }
 
-inline Move make_move(Square from, Square to) {
+constexpr Move make_move(Square from, Square to) {
   return Move((from << 6) + to);
 }
 
   return Move((from << 6) + to);
 }
 
index 3ad3a3090317d67fafeb13fad897871dff8a4726..1af8124ff9d52c2734f31f468b273adce361c630 100644 (file)
--- a/src/uci.h
+++ b/src/uci.h
@@ -50,13 +50,13 @@ public:
   Option(bool v, OnChange = nullptr);
   Option(const char* v, OnChange = nullptr);
   Option(double v, int minv, int maxv, OnChange = nullptr);
   Option(bool v, OnChange = nullptr);
   Option(const char* v, OnChange = nullptr);
   Option(double v, int minv, int maxv, OnChange = nullptr);
-  Option(const char* v, const char *cur, OnChange = nullptr);
+  Option(const char* v, const charcur, OnChange = nullptr);
 
   Option& operator=(const std::string&);
   void operator<<(const Option&);
   operator double() const;
   operator std::string() const;
 
   Option& operator=(const std::string&);
   void operator<<(const Option&);
   operator double() const;
   operator std::string() const;
-  bool operator==(const char*);
+  bool operator==(const char*) const;
 
 private:
   friend std::ostream& operator<<(std::ostream&, const OptionsMap&);
 
 private:
   friend std::ostream& operator<<(std::ostream&, const OptionsMap&);
index 5c891421ec9447ae99d726a1bf9c7bb0dd5cecd0..1f120e11120b1034b3175d84a686b4512ea33668 100644 (file)
@@ -134,7 +134,7 @@ Option::operator std::string() const {
   return currentValue;
 }
 
   return currentValue;
 }
 
-bool Option::operator==(const char* s) {
+bool Option::operator==(const char* s) const {
   assert(type == "combo");
   return    !CaseInsensitiveLess()(currentValue, s)
          && !CaseInsensitiveLess()(s, currentValue);
   assert(type == "combo");
   return    !CaseInsensitiveLess()(currentValue, s)
          && !CaseInsensitiveLess()(s, currentValue);