xref: /dragonfly/sys/cpu/x86_64/include/stdint.h (revision 63e03116)
1 /*-
2  * Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org>
3  * Copyright (c) 2001 The NetBSD Foundation, Inc.  All rights reserved.
4  * Copyright (c) 1990, 1993 The Regents of the University of California.
5  *		All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Klaus Klein.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *        This product includes software developed by the NetBSD
21  *        Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  *
38  * $FreeBSD: src/sys/i386/include/_stdint.h,v 1.1 2002/07/29 17:41:07 mike Exp $
39  */
40 
41 #ifndef _CPU_STDINT_H_
42 #define	_CPU_STDINT_H_
43 
44 #include <sys/cdefs.h>
45 
46 /*
47  * Basic types upon which most other types are built.
48  */
49 typedef	__signed char	__int8_t;
50 typedef	unsigned char	__uint8_t;
51 typedef	short		__int16_t;
52 typedef	unsigned short	__uint16_t;
53 typedef	int		__int32_t;
54 typedef	unsigned int	__uint32_t;
55 #if defined(__cplusplus) || __STDC_VERSION__ < 199901L && !__GNUC_PREREQ__(3, 0)
56 typedef	int		__boolean_t;
57 #else
58 typedef	_Bool		__boolean_t;
59 #endif
60 
61 #ifdef __LP64__
62 typedef	long		__int64_t;
63 typedef	unsigned long	__uint64_t;
64 #else
65 __extension__
66 typedef	long long	__int64_t;
67 __extension__
68 typedef	unsigned long long __uint64_t;
69 #endif
70 
71 typedef	double		__double_t;
72 typedef	float		__float_t;
73 
74 /*
75  * Basic signed and unsigned LP types.  We support LP64 and ILP32 models only.
76  */
77 #ifdef __LP64__
78 typedef	long		__intlp_t;
79 typedef	unsigned long	__uintlp_t;
80 #else
81 typedef	int		__intlp_t;
82 typedef	unsigned int	__uintlp_t;
83 #endif
84 
85 /*
86  * Standard type definitions.
87  */
88 typedef	__int64_t	__intmax_t;
89 typedef	__uint64_t	__uintmax_t;
90 
91 typedef	__intlp_t	__intptr_t;
92 typedef	__uintlp_t	__uintptr_t;
93 typedef	__intlp_t	__ptrdiff_t;	/* ptr1 - ptr2 */
94 
95 typedef	__int32_t	__int_fast8_t;
96 typedef	__int32_t	__int_fast16_t;
97 typedef	__int32_t	__int_fast32_t;
98 typedef	__int64_t	__int_fast64_t;
99 typedef	__int8_t	__int_least8_t;
100 typedef	__int16_t	__int_least16_t;
101 typedef	__int32_t	__int_least32_t;
102 typedef	__int64_t	__int_least64_t;
103 typedef	__uint32_t	__uint_fast8_t;
104 typedef	__uint32_t	__uint_fast16_t;
105 typedef	__uint32_t	__uint_fast32_t;
106 typedef	__uint64_t	__uint_fast64_t;
107 typedef	__uint8_t	__uint_least8_t;
108 typedef	__uint16_t	__uint_least16_t;
109 typedef	__uint32_t	__uint_least32_t;
110 typedef	__uint64_t	__uint_least64_t;
111 
112 /*
113  * System types conveniently placed in this header file in order to put them
114  * in proximity with the limit macros below and for convenient access by
115  * other include files which need to pick and choose particular types but
116  * do not wish to overly pollute their namespaces.
117  */
118 
119 /* <sys/types.h> */
120 typedef	unsigned long	__clock_t;	/* ticks in CLOCKS_PER_SEC */
121 typedef	unsigned long	__clockid_t;	/* CLOCK_* identifiers */
122 typedef	__int64_t	__off_t;	/* file offset or size */
123 typedef	__int32_t	__pid_t;	/* process [group] id */
124 typedef	__uintlp_t	__size_t;	/* sizes of objects */
125 typedef	__intlp_t	__ssize_t;	/* byte counts or error status */
126 typedef	long		__suseconds_t;	/* microseconds (signed) */
127 typedef	__intlp_t	__time_t;	/* epoch time */
128 typedef	int		__timer_t;	/* POSIX timer identifiers */
129 
130 /* misc types */
131 #if __GNUC_PREREQ__(2, 7)
132 typedef	int		__register_t __attribute__((__mode__(__word__)));
133 #else
134 typedef	__intlp_t	__register_t;
135 #endif
136 
137 typedef __int32_t	__sig_atomic_t;	/* XXX */
138 typedef __uint32_t	__socklen_t;
139 typedef volatile int	__atomic_intr_t;
140 typedef __int64_t	__rlim_t;
141 
142 /* kernel only for now, for __udivti3() */
143 #if defined(_KERNEL)
144 typedef	int		_int128_t __attribute__((__mode__(TI)));
145 typedef	unsigned	_uint128_t __attribute__((__mode__(TI)));
146 #endif
147 
148 #endif /* _CPU_STDINT_H_ */
149