From: Marco Costalba Date: Sat, 24 Dec 2011 08:55:35 +0000 (+0100) Subject: Correctly define operators in types.h X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=e89a8e0913640d874432bf2ca5b2495b3dcd8f7e;hp=d543a64cc7fc06daed275b332b10ea06ba738001 Correctly define operators in types.h 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 --- diff --git a/src/types.h b/src/types.h index d9efb6e8..ff7cc766 100644 --- a/src/types.h +++ b/src/types.h @@ -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 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)