20 lines
324 B
C
20 lines
324 B
C
#ifndef FIO_MIN_MAX_H
|
|
#define FIO_MIN_MAX_H
|
|
|
|
#ifndef min
|
|
#define min(x,y) ({ \
|
|
typeof(x) _x = (x); \
|
|
typeof(y) _y = (y); \
|
|
(void) (&_x == &_y); \
|
|
_x < _y ? _x : _y; })
|
|
#endif
|
|
|
|
#ifndef max
|
|
#define max(x,y) ({ \
|
|
typeof(x) _x = (x); \
|
|
typeof(y) _y = (y); \
|
|
(void) (&_x == &_y); \
|
|
_x > _y ? _x : _y; })
|
|
#endif
|
|
|
|
#endif
|