projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fio 2.2.5
[fio.git]
/
minmax.h
diff --git
a/minmax.h
b/minmax.h
index e5c2f584714fe877d7b119d16683f0a3cdd7146f..97957c8874e2e68b6e84a318d70c7c62670501bf 100644
(file)
--- a/
minmax.h
+++ b/
minmax.h
@@
-2,10
+2,19
@@
#define FIO_MIN_MAX_H
#ifndef min
#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
#endif
+
#ifndef max
#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
#endif
#endif