Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2023 Otto-von-Guericke-Universität Magdeburg
3
* SPDX-License-Identifier: LGPL-2.1-only
4
*/
5
6
#pragma once
7
17
18
#ifdef __cplusplus
19
extern
"C"
{
20
#endif
21
25
#define CONCAT(a, b) a ## b
26
30
#define CONCAT3(a, b, c) a ## b ## c
31
35
#define CONCAT4(a, b, c, d) a ## b ## c ## d
36
37
/* For compatibility with vendor headers, only provide MAX() and MIN() if not
38
* provided. (The alternative approach of using #undef has the downside that
39
* vendor header files may provide a smarter version of MAX() / MIN() that does
40
* not evaluate the argument twice and rely on this).
41
*/
42
#ifndef MAX
49
#define MAX(a, b) ((a) > (b) ? (a) : (b))
50
#endif
51
52
#ifndef MIN
59
#define MIN(a, b) ((a) < (b) ? (a) : (b))
60
#endif
61
62
#ifndef ABS
69
#define ABS(x) ((x) > 0 ? (x) : -(x))
70
#endif
71
86
#define LIMIT(val, low, high) ((val < low) ? low : (val > high) ? high : val)
87
88
#ifdef __cplusplus
89
}
90
#endif
91
Generated on Sun Nov 23 2025 23:27:56 by
1.13.2