]> wimlib.net Git - wimlib/blobdiff - include/wimlib/compiler.h
Fix 'MAX' redefined warning on macOS
[wimlib] / include / wimlib / compiler.h
index 91445b2a6ada21275e9648ff5c1cff79f7c248d0..742f3bfce1a0302fea405e77b11180a20890ffbe 100644 (file)
 #define typeof     __typeof__
 
 /* Get the minimum of two variables, without multiple evaluation.  */
-#ifndef min
-#  define min(a, b)  ({ typeof(a) _a = (a); typeof(b) _b = (b); \
-                       (_a < _b) ? _a : _b; })
-#endif
+#undef min
+#define min(a, b)  ({ typeof(a) _a = (a); typeof(b) _b = (b); \
+                   (_a < _b) ? _a : _b; })
+#undef MIN
 #define MIN(a, b)      min((a), (b))
 
 /* Get the maximum of two variables, without multiple evaluation.  */
-#ifndef max
-#  define max(a, b)  ({ typeof(a) _a = (a); typeof(b) _b = (b); \
-                       (_a > _b) ? _a : _b; })
-#endif
+#undef max
+#define max(a, b)  ({ typeof(a) _a = (a); typeof(b) _b = (b); \
+                   (_a > _b) ? _a : _b; })
+#undef MAX
 #define MAX(a, b)      max((a), (b))
 
 /* Swap the values of two variables, without multiple evaluation.  */