AGX Dynamics 2.40.1.2
Loading...
Searching...
No Matches
stdint.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17/*
18This source code has been taken and modified by Algoryx Simulation AB
19from the source and under the license given below.
20*/
21
22/* ISO C9x 7.18 Integer types <stdint.h>
23 * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794)
24 *
25 * THIS SOFTWARE IS NOT COPYRIGHTED
26 *
27 * Contributor: Danny Smith <danny_r_smith_2001@yahoo.co.nz>
28 *
29 * This source code is offered for use in the public domain. You may
30 * use, modify or distribute it freely.
31 *
32 * This code is distributed in the hope that it will be useful but
33 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
34 * DISCLAIMED. This includes but is not limited to warranties of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
36 *
37 * Date: 2000-12-02
38 */
39
40#ifndef AGX_STDINT_H
41#define AGX_STDINT_H
42
43
44#ifdef SWIG
45#if _MSC_VER >= 1600
46#endif
47#endif
48
49
50#if !defined(_WIN32) || (defined(_WIN32) && _MSC_VER >= 1600)
51# include <stdint.h>
52#else
53# define __need_wint_t
54# define __need_wchar_t
55# include <stddef.h>
56
57/* 7.18.1.1 Exact-width integer types */
58typedef signed char int8_t;
59typedef unsigned char uint8_t;
60typedef short int16_t;
61typedef unsigned short uint16_t;
62typedef int int32_t;
63typedef unsigned uint32_t;
64typedef long long int64_t;
65typedef unsigned long long uint64_t;
66
67/* 7.18.1.2 Minimum-width integer types */
68typedef signed char int_least8_t;
69typedef unsigned char uint_least8_t;
70typedef short int_least16_t;
71typedef unsigned short uint_least16_t;
72typedef int int_least32_t;
73typedef unsigned uint_least32_t;
74typedef long long int_least64_t;
75typedef unsigned long long uint_least64_t;
76
77/* 7.18.1.3 Fastest minimum-width integer types
78 * Not actually guaranteed to be fastest for all purposes
79 * Here we use the exact-width types for 8 and 16-bit ints.
80 */
81typedef char int_fast8_t;
82typedef unsigned char uint_fast8_t;
83typedef short int_fast16_t;
84typedef unsigned short uint_fast16_t;
85typedef int int_fast32_t;
86typedef unsigned int uint_fast32_t;
87typedef long long int_fast64_t;
88typedef unsigned long long uint_fast64_t;
89
90/* 7.18.1.4 Integer types capable of holding object pointers */
91#ifndef _INTPTR_T_DEFINED
92typedef int intptr_t;
93#endif
94
95#ifndef _UINTPTR_T_DEFINED
96typedef unsigned uintptr_t;
97#endif
98
99/* 7.18.1.5 Greatest-width integer types */
100typedef long long intmax_t;
101typedef unsigned long long uintmax_t;
102
103/* 7.18.2 Limits of specified-width integer types */
104#if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS)
105
106/* 7.18.2.1 Limits of exact-width integer types */
107#define INT8_MIN (-128)
108#define INT16_MIN (-32768)
109#define INT32_MIN (-2147483647 - 1)
110#define INT64_MIN (-9223372036854775807LL - 1)
111
112#define INT8_MAX 127
113#define INT16_MAX 32767
114#define INT32_MAX 2147483647
115#define INT64_MAX 9223372036854775807LL
116
117#define UINT8_MAX 0xff /* 255U */
118#define UINT16_MAX 0xffff /* 65535U */
119#define UINT32_MAX 0xffffffff /* 4294967295U */
120#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
121
122/* 7.18.2.2 Limits of minimum-width integer types */
123#define INT_LEAST8_MIN INT8_MIN
124#define INT_LEAST16_MIN INT16_MIN
125#define INT_LEAST32_MIN INT32_MIN
126#define INT_LEAST64_MIN INT64_MIN
127
128#define INT_LEAST8_MAX INT8_MAX
129#define INT_LEAST16_MAX INT16_MAX
130#define INT_LEAST32_MAX INT32_MAX
131#define INT_LEAST64_MAX INT64_MAX
132
133#define UINT_LEAST8_MAX UINT8_MAX
134#define UINT_LEAST16_MAX UINT16_MAX
135#define UINT_LEAST32_MAX UINT32_MAX
136#define UINT_LEAST64_MAX UINT64_MAX
137
138/* 7.18.2.3 Limits of fastest minimum-width integer types */
139#define INT_FAST8_MIN INT8_MIN
140#define INT_FAST16_MIN INT16_MIN
141#define INT_FAST32_MIN INT32_MIN
142#define INT_FAST64_MIN INT64_MIN
143
144#define INT_FAST8_MAX INT8_MAX
145#define INT_FAST16_MAX INT16_MAX
146#define INT_FAST32_MAX INT32_MAX
147#define INT_FAST64_MAX INT64_MAX
148
149#define UINT_FAST8_MAX UINT8_MAX
150#define UINT_FAST16_MAX UINT16_MAX
151#define UINT_FAST32_MAX UINT32_MAX
152#define UINT_FAST64_MAX UINT64_MAX
153
154/* 7.18.2.4 Limits of integer types capable of holding
155 object pointers */
156#define INTPTR_MIN INT32_MIN
157#define INTPTR_MAX INT32_MAX
158#define UINTPTR_MAX UINT32_MAX
159
160/* 7.18.2.5 Limits of greatest-width integer types */
161#define INTMAX_MIN INT64_MIN
162#define INTMAX_MAX INT64_MAX
163#define UINTMAX_MAX UINT64_MAX
164
165/* 7.18.3 Limits of other integer types */
166#define PTRDIFF_MIN INT32_MIN
167#define PTRDIFF_MAX INT32_MAX
168
169#define SIG_ATOMIC_MIN INT32_MIN
170#define SIG_ATOMIC_MAX INT32_MAX
171
172#define SIZE_MAX UINT32_MAX
173
174#ifndef WCHAR_MIN /* also in wchar.h */
175#define WCHAR_MIN 0
176#define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */
177#endif
178
179/*
180 * wint_t is unsigned short for compatibility with MS runtime
181 */
182#define WINT_MIN 0
183#define WINT_MAX ((wint_t)-1) /* UINT16_MAX */
184
185#endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */
186
187
188/* 7.18.4 Macros for integer constants */
189#if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS)
190
191/* 7.18.4.1 Macros for minimum-width integer constants
192
193 According to Douglas Gwyn <gwyn@arl.mil>:
194 "This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC
195 9899:1999 as initially published, the expansion was required
196 to be an integer constant of precisely matching type, which
197 is impossible to accomplish for the shorter types on most
198 platforms, because C99 provides no standard way to designate
199 an integer constant with width less than that of type int.
200 TC1 changed this to require just an integer constant
201 *expression* with *promoted* type."
202*/
203
204#ifndef INT8_C
205#define INT8_C(val) ((int8_t) + (val))
206#endif
207#ifndef UINT8_C
208#define UINT8_C(val) ((uint8_t) + (val##U))
209#endif
210#ifndef INT16_C
211#define INT16_C(val) ((int16_t) + (val))
212#endif
213#ifndef UINT16_C
214#define UINT16_C(val) ((uint16_t) + (val##U))
215#endif
216
217#ifndef INT32_C
218#define INT32_C(val) val##L
219#endif
220#ifndef UINT32_C
221#define UINT32_C(val) val##UL
222#endif
223#ifndef INT64_C
224#define INT64_C(val) val##LL
225#endif
226#ifndef UINT64_C
227#define UINT64_C(val) val##ULL
228#endif
229
230/* 7.18.4.2 Macros for greatest-width integer constants */
231#ifndef INTMAX_C
232#define INTMAX_C(val) INT64_C(val)
233#endif
234#ifndef UINTMAX_C
235#define UINTMAX_C(val) UINT64_C(val)
236#endif
237#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */
238
239#endif
240#endif