]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/Include/limits.h
c0e60fe007ed561f5eb318de0261611947eb8c7c
[mirror_edk2.git] / StdLib / Include / limits.h
1 /** @file
2 The header <limits.h> defines several macros that expand to various limits and
3 parameters of the standard integer types.
4
5 The values given below shall be replaced by constant expressions suitable for
6 use in #if preprocessing directives. Moreover, except for CHAR_BIT and
7 MB_LEN_MAX, the following shall be replaced by expressions that have the same
8 type as would an expression that is an object of the corresponding type
9 converted according to the integer promotions. Their implementation-defined
10 values shall be equal or greater in magnitude (absolute value) to those
11 documented, with the same sign.
12
13 If the value of an object of type char is treated as a signed integer when
14 used in an expression, the value of CHAR_MIN shall be the same as that of
15 SCHAR_MIN and the value of CHAR_MAX shall be the same as that of SCHAR_MAX.
16 Otherwise, the value of CHAR_MIN shall be 0 and the value of CHAR_MAX shall
17 be the same as that of UCHAR_MAX.)
18 The value UCHAR_MAX shall equal 2^(CHAR_BIT - 1).
19
20 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
21 This program and the accompanying materials are licensed and made available under
22 the terms and conditions of the BSD License that accompanies this distribution.
23 The full text of the license may be found at
24 http://opensource.org/licenses/bsd-license.php.
25
26 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
27 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
28
29 **/
30 #ifndef _LIMITS_H
31 #define _LIMITS_H
32 #include <sys/EfiCdefs.h>
33 #include <Library/PcdLib.h>
34
35 /* Get the architecturally defined limits for this compilation unit. */
36 #include <machine/limits.h>
37
38 /* Define the values required by Specification. */
39
40 /** maximum number of bytes in a multibyte character, for any supported locale **/
41 #define MB_LEN_MAX 2 /* 16-bit UTC-2 */
42
43 /** Number of bits for smallest object that is not a bit-field (byte). **/
44 #define CHAR_BIT __CHAR_BIT
45
46 /** minimum value for an object of type signed char **/
47 #define SCHAR_MIN __SCHAR_MIN
48
49 /** maximum value for an object of type signed char **/
50 #define SCHAR_MAX __SCHAR_MAX
51
52 /** maximum value for an object of type unsigned char **/
53 #define UCHAR_MAX __UCHAR_MAX
54
55 #ifdef __CHAR_UNSIGNED__
56 /** maximum value for an object of type char **/
57 #define CHAR_MAX UCHAR_MAX
58 /** minimum value for an object of type char **/
59 #define CHAR_MIN 0
60 #else
61 /** maximum value for an object of type char **/
62 #define CHAR_MAX SCHAR_MAX
63 /** minimum value for an object of type char **/
64 #define CHAR_MIN SCHAR_MIN
65 #endif
66
67 /** minimum value for an object of type short int **/
68 #define SHRT_MIN __SHRT_MIN
69
70 /** maximum value for an object of type short int **/
71 #define SHRT_MAX __SHRT_MAX
72
73 /** maximum value for an object of type unsigned short int **/
74 #define USHRT_MAX __USHRT_MAX
75
76 /** minimum value for an object of type int **/
77 #define INT_MIN __INT_MIN
78
79 /** maximum value for an object of type int **/
80 #define INT_MAX __INT_MAX
81
82 /** maximum value for an object of type unsigned int **/
83 #define UINT_MAX __UINT_MAX
84
85 /** minimum value for an object of type long int **/
86 #define LONG_MIN __LONG_MIN
87
88 /** maximum value for an object of type long int **/
89 #define LONG_MAX __LONG_MAX
90
91 /** maximum value for an object of type unsigned long int **/
92 #define ULONG_MAX __ULONG_MAX
93
94 /** minimum value for an object of type long long int **/
95 #define LLONG_MIN __LLONG_MIN
96
97 /** maximum value for an object of type long long int **/
98 #define LLONG_MAX __LLONG_MAX
99
100 /** maximum value for an object of type unsigned long long int **/
101 #define ULLONG_MAX __ULLONG_MAX
102
103 /* Object limits used in the Standard Libraries */
104 #if (PcdGet32(PcdMaximumAsciiStringLength) > 0)
105 #define ASCII_STRING_MAX PcdGet32(PcdMaximumAsciiStringLength)
106 #else
107 #define ASCII_STRING_MAX 256
108 #endif
109
110 #if (PcdGet32(PcdMaximumUnicodeStringLength) > 0)
111 #define UNICODE_STRING_MAX PcdGet32(PcdMaximumUnicodeStringLength)
112 #else
113 #define UNICODE_STRING_MAX 512
114 #endif
115
116 /* Limits for BSD Compatibility */
117 #define NL_TEXTMAX 2048
118 #include <sys/syslimits.h>
119
120 #endif /* _LIMITS_H */