X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=minmax.h;h=97957c8874e2e68b6e84a318d70c7c62670501bf;hp=e5c2f584714fe877d7b119d16683f0a3cdd7146f;hb=f747ad2c5352b977007997b454333be37de7f4c9;hpb=c0b69b92fb155424946b19228da9be0924e9e96c diff --git a/minmax.h b/minmax.h index e5c2f584..97957c88 100644 --- a/minmax.h +++ b/minmax.h @@ -2,10 +2,19 @@ #define FIO_MIN_MAX_H #ifndef min -#define min(a, b) ((a) < (b) ? (a) : (b)) +#define min(x,y) ({ \ + typeof(x) _x = (x); \ + typeof(y) _y = (y); \ + (void) (&_x == &_y); \ + _x < _y ? _x : _y; }) #endif + #ifndef max -#define max(a, b) ((a) > (b) ? (a) : (b)) +#define max(x,y) ({ \ + typeof(x) _x = (x); \ + typeof(y) _y = (y); \ + (void) (&_x == &_y); \ + _x > _y ? _x : _y; }) #endif #endif