]> git.sesse.net Git - stockfish/commitdiff
Correctly define operators in types.h
authorMarco Costalba <mcostalba@gmail.com>
Sat, 24 Dec 2011 08:55:35 +0000 (09:55 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 24 Dec 2011 08:58:46 +0000 (09:58 +0100)
Be consistent with the way these operators are defined
in plain C (and in C++).

Spotted by Lucas Braesch.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/types.h

index d9efb6e8a16a871b79a8ddeb115b58af63fd3da9..ff7cc76684b7b5eb17b7a4b6c3bafdde55df80df 100644 (file)
@@ -323,10 +323,10 @@ inline T operator/ (const T d, int i) { return T(int(d) / i); } \
 inline T operator- (const T d) { return T(-int(d)); } \
 inline T operator++ (T& d, int) {d = T(int(d) + 1); return d; } \
 inline T operator-- (T& d, int) { d = T(int(d) - 1); return d; } \
 inline T operator- (const T d) { return T(-int(d)); } \
 inline T operator++ (T& d, int) {d = T(int(d) + 1); return d; } \
 inline T operator-- (T& d, int) { d = T(int(d) - 1); return d; } \
-inline void operator+= (T& d1, const T d2) { d1 = d1 + d2; } \
-inline void operator-= (T& d1, const T d2) { d1 = d1 - d2; } \
-inline void operator*= (T& d, int i) { d = T(int(d) * i); } \
-inline void operator/= (T& d, int i) { d = T(int(d) / i); }
+inline T& operator+= (T& d1, const T d2) { d1 = d1 + d2; return d1; } \
+inline T& operator-= (T& d1, const T d2) { d1 = d1 - d2; return d1; } \
+inline T& operator*= (T& d, int i) { d = T(int(d) * i); return d; } \
+inline T& operator/= (T& d, int i) { d = T(int(d) / i); return d; }
 
 ENABLE_OPERATORS_ON(Value)
 ENABLE_OPERATORS_ON(PieceType)
 
 ENABLE_OPERATORS_ON(Value)
 ENABLE_OPERATORS_ON(PieceType)