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
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.
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]
23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
25 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
29 #ifndef _SYS_INT_CONST_H
30 #define _SYS_INT_CONST_H
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.
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
42 * <sys/inttypes.h> Provides the Kernel and Driver appropriate
43 * components of <inttypes.h>.
45 * <inttypes.h> For use by applications.
47 * See these files for more details.
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.
54 #include <sys/feature_tests.h>
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
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.
76 #define __CONCAT__(A,B) A ## B
79 #define INT16_C(c) (c)
80 #define INT32_C(c) (c)
83 #define INT64_C(c) __CONCAT__(c,l)
85 #if defined(_LONGLONG_TYPE)
87 #define INT64_C(c) __CONCAT__(c,ll)
92 #define UINT8_C(c) __CONCAT__(c,u)
94 #define UINT16_C(c) __CONCAT__(c,u)
96 #define UINT32_C(c) __CONCAT__(c,u)
99 #define UINT64_C(c) __CONCAT__(c,ul)
101 #if defined(_LONGLONG_TYPE)
103 #define UINT64_C(c) __CONCAT__(c,ull)
109 #define INTMAX_C(c) __CONCAT__(c,l)
111 #define UINTMAX_C(c) __CONCAT__(c,ul)
113 #if defined(_LONGLONG_TYPE)
115 #define INTMAX_C(c) __CONCAT__(c,ll)
117 #define UINTMAX_C(c) __CONCAT__(c,ull)
119 #define INTMAX_C(c) (c)
120 #define UINTMAX_C(c) (c)
128 #endif /* _SYS_INT_CONST_H */