]> git.sur5r.net Git - cc65/blob - include/stdint.h
Merge pull request #620 from blackystardust/master
[cc65] / include / stdint.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                 stdint.h                                  */
4 /*                                                                           */
5 /*                          Standard integer types                           */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 2002      Ullrich von Bassewitz                                       */
10 /*               Wacholderweg 14                                             */
11 /*               D-70597 Stuttgart                                           */
12 /* EMail:        uz@musoftware.de                                            */
13 /*                                                                           */
14 /*                                                                           */
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.                                    */
18 /*                                                                           */
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:                            */
22 /*                                                                           */
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              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
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.
38 */
39
40
41
42 #ifndef _STDINT_H
43 #define _STDINT_H
44
45
46
47 /* Exact-width integer types */
48 typedef signed char         int8_t;
49 typedef int                 int16_t;
50 typedef long                int32_t;
51 typedef unsigned char       uint8_t;
52 typedef unsigned            uint16_t;
53 typedef unsigned long       uint32_t;
54
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)
64
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;
72
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)
82
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;
90
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)
100
101 /* Integer types capable of holding object pointers */
102 typedef int                 intptr_t;
103 typedef unsigned            uintptr_t;
104
105 #define INTPTR_MIN          ((intptr_t)0x8000)
106 #define INTPTR_MAX          ((intptr_t)0x7FFF)
107 #define UINTPTR_MAX         ((uintptr_t) 0xFFFF)
108
109 /* Greatest width integer types */
110 typedef long                intmax_t;
111 typedef unsigned long       uintmax_t;
112
113 #define INTMAX_MIN          ((intmax_t) 0x80000000)
114 #define INTMAX_MAX          ((intmax_t) 0x7FFFFFFF)
115 #define UINTMAX_MAX         ((uintmax_t) 0xFFFFFFFF)
116
117 /* Limits of other integer types */
118 #define PTRDIFF_MIN         ((int) 0x8000)
119 #define PTRDIFF_MAX         ((int) 0x7FFF)
120
121 #define SIG_ATOMIC_MIN      ((unsigned char) 0x00)
122 #define SIG_ATOMIC_MAX      ((unsigned char) 0xFF)
123
124 #define SIZE_MAX            0xFFFF
125
126 /* Macros for minimum width integer constants */
127 #define INT8_C(c)           c
128 #define INT16_C(c)          c
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
133
134 /* Macros for greatest width integer constants */
135 #define INTMAX_C(c)         c##L
136 #define UINTMAX_C(c)        c##UL
137
138
139
140 /* End of stdint.h */
141 #endif
142
143
144