3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _SYS_INT_CONST_H
28 #define _SYS_INT_CONST_H
29
30 #pragma ident "%Z%%M% %I% %E% SMI"
31
32 /*
33 * This file, <sys/int_const.h>, is part of the Sun Microsystems implementation
34 * of <inttypes.h> as proposed in the ISO/JTC1/SC22/WG14 C committee's working
35 * draft for the revision of the current ISO C standard, ISO/IEC 9899:1990
36 * Programming language - C.
37 *
38 * Programs/Modules should not directly include this file. Access to the
39 * types defined in this file should be through the inclusion of one of the
40 * following files:
41 *
42 * <sys/inttypes.h> Provides the Kernel and Driver appropriate
43 * components of <inttypes.h>.
44 *
45 * <inttypes.h> For use by applications.
46 *
47 * See these files for more details.
48 *
49 * Use at your own risk. This file will track the evolution of the revision
50 * of the current ISO C standard. As of February 1996, the committee is
51 * squarely behind the fixed sized types.
55
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59
60 /*
61 * Constants
62 *
63 * The following macros create constants of the types defined in
64 * <sys/int_types.h>. The intent is that:
65 * Constants defined using these macros have a specific size and
66 * signedness. The suffix used for int64_t and uint64_t (ll and ull)
67 * are for examples only. Implementations are permitted to use other
68 * suffixes.
69 *
70 * The "CSTYLED" comments are flags to an internal code style analysis tool
71 * telling it to silently accept the line which follows. This internal
72 * standard requires a space between arguments, but the historical,
73 * non-ANSI-C ``method'' of concatenation can't tolerate those spaces.
74 */
75 #ifdef __STDC__
76 /* CSTYLED */
77 #define __CONCAT__(A,B) A ## B
78 #else
79 /* CSTYLED */
80 #define __CONCAT__(A,B) A/**/B
81 #endif
82
83 #if defined(_CHAR_IS_SIGNED) || defined(__STDC__)
84 #define INT8_C(c) (c)
85 #endif
86 #define INT16_C(c) (c)
87 #define INT32_C(c) (c)
88 #ifdef _LP64
89 /* CSTYLED */
90 #define INT64_C(c) __CONCAT__(c,l)
91 #else /* _ILP32 */
92 #if defined(_LONGLONG_TYPE)
93 /* CSTYLED */
94 #define INT64_C(c) __CONCAT__(c,ll)
95 #endif
96 #endif
97
98 /* CSTYLED */
99 #define UINT8_C(c) __CONCAT__(c,u)
100 /* CSTYLED */
101 #define UINT16_C(c) __CONCAT__(c,u)
102 /* CSTYLED */
103 #define UINT32_C(c) __CONCAT__(c,u)
104 #ifdef _LP64
105 /* CSTYLED */
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 *
25 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
27 */
28
29 #ifndef _SYS_INT_CONST_H
30 #define _SYS_INT_CONST_H
31
32 /*
33 * This file, <sys/int_const.h>, is part of the Sun Microsystems implementation
34 * of <inttypes.h> as proposed in the ISO/JTC1/SC22/WG14 C committee's working
35 * draft for the revision of the current ISO C standard, ISO/IEC 9899:1990
36 * Programming language - C.
37 *
38 * Programs/Modules should not directly include this file. Access to the
39 * types defined in this file should be through the inclusion of one of the
40 * following files:
41 *
42 * <sys/inttypes.h> Provides the Kernel and Driver appropriate
43 * components of <inttypes.h>.
44 *
45 * <inttypes.h> For use by applications.
46 *
47 * See these files for more details.
48 *
49 * Use at your own risk. This file will track the evolution of the revision
50 * of the current ISO C standard. As of February 1996, the committee is
51 * squarely behind the fixed sized types.
55
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59
60 /*
61 * Constants
62 *
63 * The following macros create constants of the types defined in
64 * <sys/int_types.h>. The intent is that:
65 * Constants defined using these macros have a specific size and
66 * signedness. The suffix used for int64_t and uint64_t (ll and ull)
67 * are for examples only. Implementations are permitted to use other
68 * suffixes.
69 *
70 * The "CSTYLED" comments are flags to an internal code style analysis tool
71 * telling it to silently accept the line which follows. This internal
72 * standard requires a space between arguments, but the historical,
73 * non-ANSI-C ``method'' of concatenation can't tolerate those spaces.
74 */
75 /* CSTYLED */
76 #define __CONCAT__(A,B) A ## B
77
78 #define INT8_C(c) (c)
79 #define INT16_C(c) (c)
80 #define INT32_C(c) (c)
81 #ifdef _LP64
82 /* CSTYLED */
83 #define INT64_C(c) __CONCAT__(c,l)
84 #else /* _ILP32 */
85 #if defined(_LONGLONG_TYPE)
86 /* CSTYLED */
87 #define INT64_C(c) __CONCAT__(c,ll)
88 #endif
89 #endif
90
91 /* CSTYLED */
92 #define UINT8_C(c) __CONCAT__(c,u)
93 /* CSTYLED */
94 #define UINT16_C(c) __CONCAT__(c,u)
95 /* CSTYLED */
96 #define UINT32_C(c) __CONCAT__(c,u)
97 #ifdef _LP64
98 /* CSTYLED */
|