Zephyr API 3.6.99
Loading...
Searching...
No Matches
limits.h
Go to the documentation of this file.
1/* limits.h */
2
3/*
4 * Copyright (c) 2014 Wind River Systems, Inc.
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
9#ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_LIMITS_H_
10#define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_LIMITS_H_
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#if __CHAR_BIT__ == 8
17#define UCHAR_MAX 0xFFU
18#else
19#error "unexpected __CHAR_BIT__ value"
20#endif
21
22#define SCHAR_MAX __SCHAR_MAX__
23#define SCHAR_MIN (-SCHAR_MAX - 1)
24
25#ifdef __CHAR_UNSIGNED__
26 /* 'char' is an unsigned type */
27 #define CHAR_MAX UCHAR_MAX
28 #define CHAR_MIN 0
29#else
30 /* 'char' is a signed type */
31 #define CHAR_MAX SCHAR_MAX
32 #define CHAR_MIN SCHAR_MIN
33#endif
34
35#define CHAR_BIT __CHAR_BIT__
36#define LONG_BIT (__SIZEOF_LONG__ * CHAR_BIT)
37#define WORD_BIT (__SIZEOF_POINTER__ * CHAR_BIT)
38
39#define INT_MAX __INT_MAX__
40#define SHRT_MAX __SHRT_MAX__
41#define LONG_MAX __LONG_MAX__
42#define LLONG_MAX __LONG_LONG_MAX__
43
44#define INT_MIN (-INT_MAX - 1)
45#define SHRT_MIN (-SHRT_MAX - 1)
46#define LONG_MIN (-LONG_MAX - 1L)
47#define LLONG_MIN (-LLONG_MAX - 1LL)
48
49#if __SIZE_MAX__ == __UINT32_MAX__
50#define SSIZE_MAX __INT32_MAX__
51#elif __SIZE_MAX__ == __UINT64_MAX__
52#define SSIZE_MAX __INT64_MAX__
53#else
54#error "unexpected __SIZE_MAX__ value"
55#endif
56
57#if __SIZEOF_SHORT__ == 2
58#define USHRT_MAX 0xFFFFU
59#else
60#error "unexpected __SIZEOF_SHORT__ value"
61#endif
62
63#if __SIZEOF_INT__ == 4
64#define UINT_MAX 0xFFFFFFFFU
65#else
66#error "unexpected __SIZEOF_INT__ value"
67#endif
68
69#if __SIZEOF_LONG__ == 4
70#define ULONG_MAX 0xFFFFFFFFUL
71#elif __SIZEOF_LONG__ == 8
72#define ULONG_MAX 0xFFFFFFFFFFFFFFFFUL
73#else
74#error "unexpected __SIZEOF_LONG__ value"
75#endif
76
77#if __SIZEOF_LONG_LONG__ == 8
78#define ULLONG_MAX 0xFFFFFFFFFFFFFFFFULL
79#else
80#error "unexpected __SIZEOF_LONG_LONG__ value"
81#endif
82
83#define PATH_MAX 256
84
85#ifdef __cplusplus
86}
87#endif
88
89#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_LIMITS_H_ */