summaryrefslogtreecommitdiffstats
path: root/kernel/tests/include/tst_minmax.h
blob: 6417dd703e7f958b1c88d52675c16680f4422d26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
 */

#ifndef TST_MINMAX_H__
#define TST_MINMAX_H__

#ifndef MIN
# define MIN(a, b) ({ \
	typeof(a) _a = (a); \
	typeof(b) _b = (b); \
	_a < _b ? _a : _b; \
})
#endif /* MIN */

#ifndef MAX
# define MAX(a, b) ({ \
	typeof(a) _a = (a); \
	typeof(b) _b = (b); \
	_a > _b ? _a : _b; \
})
#endif /* MAX */

#endif	/* TST_MINMAX_H__ */