ic-macros  0.1.5
ic_macros.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023, Intercreate, Inc.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Zephyr Util Macros
7  * Copyright (c) 2011-2014, Wind River Systems, Inc.
8  * Copyright (c) 2021, Nordic Semiconductor ASA
9  *
10  * SPDX-License-Identifier: Apache-2.0
11  */
12 
13 #pragma once
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
20 #include "ic_macros/assert_type.h"
21 #include "ic_macros/enum_cast.h"
22 #include "ic_macros/integer_cast.h"
23 #include "zephyr/build_assert.h"
24 #include "zephyr/util.h"
25 
30 #define IC_G_ABS(x) ((x) < 0 ? (-(x)) : (x))
31 
36 #define IC_ABS(x) _IC_MAKE_SINGLE_EVAL_1(IC_G_ABS, x)
37 
38 #define IC_ANSI_RED "\x1b[31m"
39 #define IC_ANSI_GREEN "\x1b[32m"
40 #define IC_ANSI_YELLOW "\x1b[33m"
41 #define IC_ANSI_BLUE "\x1b[34m"
42 #define IC_ANSI_MAGENTA "\x1b[95m"
43 #define IC_ANSI_CYAN "\x1b[96m"
44 #define IC_ANSI_BOLD "\x1b[1m"
45 #define IC_ANSI_DIM "\x1b[2m"
46 #define IC_ANSI_DIM2 "\x1b[38;5;241m"
47 #define IC_ANSI_NONE ""
48 #define IC_ANSI_RESET "\x1b[0m"
49 
60 #define IC_INLINE inline __attribute__((always_inline))
61 
68 #define IC_PACK __attribute__((packed))
69 
102 #define IC_CONST __attribute__((const))
103 
142 #define IC_PURE __attribute__((pure))
143 
144 #ifdef __cplusplus
145 }
146 #endif