Introduce limits wrapper
[lttng-modules.git] / include / wrapper / limits.h
1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
2 *
3 * wrapper/limits.h
4 *
5 * Copyright (C) 2020 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 */
7
8 #ifndef _LTTNG_WRAPPER_LIMITS_H
9 #define _LTTNG_WRAPPER_LIMITS_H
10
11 #include <linux/limits.h>
12
13 #ifndef SIZE_MAX
14 #define SIZE_MAX (~(size_t)0)
15 #endif
16 #ifndef PHYS_ADDR_MAX
17 #define PHYS_ADDR_MAX (~(phys_addr_t)0)
18 #endif
19
20 #ifndef U8_MAX
21 #define U8_MAX ((u8)~0U)
22 #endif
23 #ifndef S8_MAX
24 #define S8_MAX ((s8)(U8_MAX >> 1))
25 #endif
26 #ifndef S8_MIN
27 #define S8_MIN ((s8)(-S8_MAX - 1))
28 #endif
29 #ifndef U16_MAX
30 #define U16_MAX ((u16)~0U)
31 #endif
32 #ifndef S16_MAX
33 #define S16_MAX ((s16)(U16_MAX >> 1))
34 #endif
35 #ifndef S16_MIN
36 #define S16_MIN ((s16)(-S16_MAX - 1))
37 #endif
38 #ifndef U32_MAX
39 #define U32_MAX ((u32)~0U)
40 #endif
41 #ifndef U32_MIN
42 #define U32_MIN ((u32)0)
43 #endif
44 #ifndef S32_MAX
45 #define S32_MAX ((s32)(U32_MAX >> 1))
46 #endif
47 #ifndef S32_MIN
48 #define S32_MIN ((s32)(-S32_MAX - 1))
49 #endif
50 #ifndef U64_MAX
51 #define U64_MAX ((u64)~0ULL)
52 #endif
53 #ifndef S64_MAX
54 #define S64_MAX ((s64)(U64_MAX >> 1))
55 #endif
56 #ifndef S64_MIN
57 #define S64_MIN ((s64)(-S64_MAX - 1))
58 #endif
59
60 #endif /* _LTTNG_WRAPPER_COMPILER_H */
This page took 0.031063 seconds and 4 git commands to generate.