1/* SPDX-License-Identifier: GPL-2.0-or-later 2 * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz> 3 * Copyright (c) Linux Test Project, 2020-2023 4 */ 5 6#ifndef TST_MINMAX_H__ 7#define TST_MINMAX_H__ 8 9#include <sys/param.h> 10 11#ifndef MIN 12# define MIN(a, b) ({ \ 13 typeof(a) _a = (a); \ 14 typeof(b) _b = (b); \ 15 (void) (&_a == &_b); \ 16 _a < _b ? _a : _b; \ 17}) 18#endif /* MIN */ 19 20#ifndef MAX 21# define MAX(a, b) ({ \ 22 typeof(a) _a = (a); \ 23 typeof(b) _b = (b); \ 24 (void) (&_a == &_b); \ 25 _a > _b ? _a : _b; \ 26}) 27#endif /* MAX */ 28 29#endif /* TST_MINMAX_H__ */ 30