-// Templetized enum operations, we avoid to repeat the same inlines for each
-// different enum.
-
-template<typename T>
-inline T operator+ (const T d1, const T d2) { return T(int(d1) + int(d2)); }
-
-template<typename T>
-inline T operator- (const T d1, const T d2) { return T(int(d1) - int(d2)); }
-
-template<typename T>
-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 void operator++ (T& d, int) { d = T(int(d) + 1); }
-
-template<typename T>
-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& d, int i) { d = T(int(d) * i); }
-
-template<typename T>
-inline void operator/= (T &d, int i) { d = T(int(d) / i); }
+// Operators used by enum types like Depth, Piece, Square and so on.
+
+#define ENABLE_OPERATORS_ON(T) \
+inline T operator+ (const T d1, const T d2) { return T(int(d1) + int(d2)); } \
+inline T operator- (const T d1, const T d2) { return T(int(d1) - int(d2)); } \
+inline T operator* (int i, const T d) { return T(i * int(d)); } \
+inline T operator* (const T d, int i) { return T(int(d) * i); } \
+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); }