| 1 | // SPDX-FileCopyrightText: 2018 Michael Jeanson <mjeanson@efficios.com> |
| 2 | // |
| 3 | // SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 | |
| 5 | #ifndef _URCU_UTILS_H |
| 6 | #define _URCU_UTILS_H |
| 7 | |
| 8 | /* |
| 9 | * Userspace RCU library internal utils |
| 10 | */ |
| 11 | |
| 12 | #include <urcu/config.h> |
| 13 | |
| 14 | #define urcu_stringify(a) _urcu_stringify(a) |
| 15 | #define _urcu_stringify(a) #a |
| 16 | |
| 17 | #define max_t(type, x, y) \ |
| 18 | ({ \ |
| 19 | type __max1 = (x); \ |
| 20 | type __max2 = (y); \ |
| 21 | __max1 > __max2 ? __max1: __max2; \ |
| 22 | }) |
| 23 | |
| 24 | #define min_t(type, x, y) \ |
| 25 | ({ \ |
| 26 | type __min1 = (x); \ |
| 27 | type __min2 = (y); \ |
| 28 | __min1 <= __min2 ? __min1: __min2; \ |
| 29 | }) |
| 30 | |
| 31 | #endif /* _URCU_UTILS_H */ |