#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
+#ifndef min
+#define min(x, y) \
+ ({ \
+ const typeof(x) _x = (x); \
+ const typeof(y) _y = (y); \
+ (void) (&_x == &_y); \
+ (_x < _y) ? _x : _y; \
+ })
+#endif
+
+#ifndef max
+#define max(x, y) \
+ ({ \
+ const typeof(x) _x = (x); \
+ const typeof(y) _y = (y); \
+ (void)(&_x == &_y); \
+ (_x > _y) ? _x : _y; \
+ })
+#endif
+
+#ifndef min_t
+#define min_t(type, x, y) \
+ ({ \
+ const type _x = (x); \
+ const type _y = (y); \
+ (_x < _y) ? _x: _y; \
+ })
+#endif
+
+#ifndef max_t
+#define max_t(type, x, y) \
+ ({ \
+ const type _x = (x); \
+ const type _y = (y); \
+ (_x > _y) ? _x: _y; \
+ })
+#endif
+
#endif /* __XEN_TOOLS_LIBS__ */
int xc_ffs32(uint32_t x);
int xc_ffs64(uint64_t x);
-#define min(X, Y) ({ \
- const typeof (X) _x = (X); \
- const typeof (Y) _y = (Y); \
- (void) (&_x == &_y); \
- (_x < _y) ? _x : _y; })
-#define max(X, Y) ({ \
- const typeof (X) _x = (X); \
- const typeof (Y) _y = (Y); \
- (void) (&_x == &_y); \
- (_x > _y) ? _x : _y; })
-
-#define min_t(type,x,y) \
- ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
-#define max_t(type,x,y) \
- ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
-
#define DOMPRINTF(fmt, args...) xc_dom_printf(dom->xch, fmt, ## args)
#define DOMPRINTF_CALLED(xch) xc_dom_printf((xch), "%s: called", __FUNCTION__)
#define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
-#define min(X, Y) ({ \
- const typeof (X) _x = (X); \
- const typeof (Y) _y = (Y); \
- (void) (&_x == &_y); \
- (_x < _y) ? _x : _y; })
-#define max(X, Y) ({ \
- const typeof (X) _x = (X); \
- const typeof (Y) _y = (Y); \
- (void) (&_x == &_y); \
- (_x > _y) ? _x : _y; })
-
-#define min_t(type, x, y) \
- ({ const type _x = (x); const type _y = (y); _x < _y ? _x: _y; })
-#define max_t(type, x, y) \
- ({ const type _x = (x); const type _y = (y); _x > _y ? _x: _y; })
-
#define LIBXL__LOGGING_ENABLED
#ifdef LIBXL__LOGGING_ENABLED