]> git.sesse.net Git - stockfish/blobdiff - src/types.h
Use Use templetized operations for Score and Value
[stockfish] / src / types.h
index f018311dc70f629b4d324a9ed96b379cf0e7f587..d81e7e80a33f3c391c9bf530996a3a61c2d40e71 100644 (file)
@@ -125,6 +125,9 @@ inline T operator* (int i, const T d) { return T(int(d) * i); }
 template<typename T>
 inline T operator/ (const T d, int i) { return T(int(d) / i); }
 
+template<typename T>
+inline T operator- (const T d) { return T(-int(d)); }
+
 template<typename T>
 inline void operator++ (T& d, int) { d = T(int(d) + 1); }
 
@@ -134,6 +137,9 @@ inline void operator-- (T& d, int) { d = T(int(d) - 1); }
 template<typename T>
 inline void operator+= (T& d1, const T d2) { d1 = d1 + d2; }
 
+template<typename T>
+inline void operator-= (T& d1, const T d2) { d1 = d1 - d2; }
+
 template<typename T>
 inline void operator*= (T& d, int i) { d = T(int(d) * i); }