1 /*
2  * Copyright (c) 2010-2014 Wind River Systems, Inc.
3  * Copyright (c) 2023 Nordic Semiconductor ASA
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #ifndef NSI_COMMON_SRC_INCL_NSI_UTILS_H
9 #define NSI_COMMON_SRC_INCL_NSI_UTILS_H
10 
11 /* Remove brackets from around a single argument: */
12 #define NSI_DEBRACKET(...) __VA_ARGS__
13 
14 #define _NSI_STRINGIFY(x) #x
15 #define NSI_STRINGIFY(s) _NSI_STRINGIFY(s)
16 
17 /* concatenate the values of the arguments into one */
18 #define NSI_DO_CONCAT(x, y) x ## y
19 #define NSI_CONCAT(x, y) NSI_DO_CONCAT(x, y)
20 
21 #define NSI_MAX(a, b)  (((a) > (b)) ? (a) : (b))
22 #define NSI_MIN(a, b) (((a) < (b)) ? (a) : (b))
23 
24 #ifndef NSI_ARG_UNUSED
25 #define NSI_ARG_UNUSED(x) (void)(x)
26 #endif
27 
28 #define NSI_CODE_UNREACHABLE __builtin_unreachable()
29 
30 #define NSI_FUNC_NORETURN __attribute__((__noreturn__))
31 
32 #endif /* NSI_COMMON_SRC_INCL_NSI_UTILS_H */
33