1 /*****************************************************************************/
5 /* Standard integer types */
9 /* (C) 2002 Ullrich von Bassewitz */
11 /* D-70597 Stuttgart */
12 /* EMail: uz@musoftware.de */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
36 /* Note: This file is not fully ISO 9899-1999 compliant because cc65 lacks
37 ** a 64 bit data types. The declarations have been adjusted accordingly.
47 /* Exact-width integer types */
48 typedef signed char int8_t;
51 typedef unsigned char uint8_t;
52 typedef unsigned uint16_t;
53 typedef unsigned long uint32_t;
55 #define INT8_MIN ((int8_t) 0x80)
56 #define INT8_MAX ((int8_t) 0x7F)
57 #define INT16_MIN ((int16_t) 0x8000)
58 #define INT16_MAX ((int16_t) 0x7FFF)
59 #define INT32_MIN ((int32_t) 0x80000000)
60 #define INT32_MAX ((int32_t) 0x7FFFFFFF)
61 #define UINT8_MAX ((uint8_t) 0xFF)
62 #define UINT16_MAX ((uint16_t) 0xFFFF)
63 #define UINT32_MAX ((uint32_t) 0xFFFFFFFF)
65 /* Minimum-width integer types */
66 typedef signed char int_least8_t;
67 typedef int int_least16_t;
68 typedef long int_least32_t;
69 typedef unsigned char uint_least8_t;
70 typedef unsigned uint_least16_t;
71 typedef unsigned long uint_least32_t;
73 #define INT_LEAST8_MIN ((int_least8_t) 0x80)
74 #define INT_LEAST8_MAX ((int_least8_t) 0x7F)
75 #define INT_LEAST16_MIN ((int_least16_t) 0x8000)
76 #define INT_LEAST16_MAX ((int_least16_t) 0x7FFF)
77 #define INT_LEAST32_MIN ((int_least32_t) 0x80000000)
78 #define INT_LEAST32_MAX ((int_least32_t) 0x7FFFFFFF)
79 #define UINT_LEAST8_MAX ((uint_least8_t) 0xFF)
80 #define UINT_LEAST16_MAX ((uint_least16_t) 0xFFFF)
81 #define UINT_LEAST32_MAX ((uint_least32_t) 0xFFFFFFFF)
83 /* Fastest minimum-width integer types */
84 typedef signed char int_fast8_t;
85 typedef int int_fast16_t;
86 typedef long int_fast32_t;
87 typedef unsigned char uint_fast8_t;
88 typedef unsigned uint_fast16_t;
89 typedef unsigned long uint_fast32_t;
91 #define INT_FAST8_MIN ((int_fast8_t) 0x80)
92 #define INT_FAST8_MAX ((int_fast8_t) 0x7F)
93 #define INT_FAST16_MIN ((int_fast16_t) 0x8000)
94 #define INT_FAST16_MAX ((int_fast16_t) 0x7FFF)
95 #define INT_FAST32_MIN ((int_fast32_t) 0x80000000)
96 #define INT_FAST32_MAX ((int_fast32_t) 0x7FFFFFFF)
97 #define UINT_FAST8_MAX ((uint_fast8_t) 0xFF)
98 #define UINT_FAST16_MAX ((uint_fast16_t) 0xFFFF)
99 #define UINT_FAST32_MAX ((uint_fast32_t) 0xFFFFFFFF)
101 /* Integer types capable of holding object pointers */
102 typedef int intptr_t;
103 typedef unsigned uintptr_t;
105 #define INTPTR_MIN ((intptr_t)0x8000)
106 #define INTPTR_MAX ((intptr_t)0x7FFF)
107 #define UINTPTR_MAX ((uintptr_t) 0xFFFF)
109 /* Greatest width integer types */
110 typedef long intmax_t;
111 typedef unsigned long uintmax_t;
113 #define INTMAX_MIN ((intmax_t) 0x80000000)
114 #define INTMAX_MAX ((intmax_t) 0x7FFFFFFF)
115 #define UINTMAX_MAX ((uintmax_t) 0xFFFFFFFF)
117 /* Limits of other integer types */
118 #define PTRDIFF_MIN ((int) 0x8000)
119 #define PTRDIFF_MAX ((int) 0x7FFF)
121 #define SIG_ATOMIC_MIN ((unsigned char) 0x00)
122 #define SIG_ATOMIC_MAX ((unsigned char) 0xFF)
124 #define SIZE_MAX 0xFFFF
126 /* Macros for minimum width integer constants */
129 #define INT32_C(c) c##L
130 #define UINT8_C(c) c##U
131 #define UINT16_C(c) c##U
132 #define UINT32_C(c) c##UL
134 /* Macros for greatest width integer constants */
135 #define INTMAX_C(c) c##L
136 #define UINTMAX_C(c) c##UL
140 /* End of stdint.h */