projects
/
fio.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
rand: use bools
[fio.git]
/
minmax.h
1
#ifndef FIO_MIN_MAX_H
2
#define FIO_MIN_MAX_H
3
4
#ifndef min
5
#define min(x,y) ({ \
6
typeof(x) _x = (x); \
7
typeof(y) _y = (y); \
8
(void) (&_x == &_y); \
9
_x < _y ? _x : _y; })
10
#endif
11
12
#ifndef max
13
#define max(x,y) ({ \
14
typeof(x) _x = (x); \
15
typeof(y) _y = (y); \
16
(void) (&_x == &_y); \
17
_x > _y ? _x : _y; })
18
#endif
19
20
#define min_not_zero(x, y) ({ \
21
typeof(x) __x = (x); \
22
typeof(y) __y = (y); \
23
__x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); })
24
25
#endif