| 1 | #ifndef __NETTLE_STDINT_H |
| 2 | #define __NETTLE_STDINT_H 1 |
| 3 | #ifndef _GENERATED_STDINT_H |
| 4 | #define _GENERATED_STDINT_H " " |
| 5 | /* generated using gcc */ |
| 6 | #define _STDINT_HAVE_STDINT_H 1 |
| 7 | |
| 8 | /* ................... shortcircuit part ........................... */ |
| 9 | |
| 10 | #if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H |
| 11 | #include <stdint.h> |
| 12 | #else |
| 13 | #include <stddef.h> |
| 14 | |
| 15 | /* .................... configured part ............................ */ |
| 16 | |
| 17 | /* whether we have a C99 compatible stdint header file */ |
| 18 | /* #undef _STDINT_HEADER_INTPTR */ |
| 19 | /* whether we have a C96 compatible inttypes header file */ |
| 20 | /* #undef _STDINT_HEADER_UINT32 */ |
| 21 | /* whether we have a BSD compatible inet types header */ |
| 22 | /* #undef _STDINT_HEADER_U_INT32 */ |
| 23 | |
| 24 | /* which 64bit typedef has been found */ |
| 25 | /* #undef _STDINT_HAVE_UINT64_T */ |
| 26 | /* #undef _STDINT_HAVE_U_INT64_T */ |
| 27 | |
| 28 | /* which type model has been detected */ |
| 29 | /* #undef _STDINT_CHAR_MODEL // skipped */ |
| 30 | /* #undef _STDINT_LONG_MODEL // skipped */ |
| 31 | |
| 32 | /* whether int_least types were detected */ |
| 33 | /* #undef _STDINT_HAVE_INT_LEAST32_T */ |
| 34 | /* whether int_fast types were detected */ |
| 35 | /* #undef _STDINT_HAVE_INT_FAST32_T */ |
| 36 | /* whether intmax_t type was detected */ |
| 37 | /* #undef _STDINT_HAVE_INTMAX_T */ |
| 38 | |
| 39 | /* .................... detections part ............................ */ |
| 40 | |
| 41 | /* whether we need to define bitspecific types from compiler base types */ |
| 42 | #ifndef _STDINT_HEADER_INTPTR |
| 43 | #ifndef _STDINT_HEADER_UINT32 |
| 44 | #ifndef _STDINT_HEADER_U_INT32 |
| 45 | #define _STDINT_NEED_INT_MODEL_T |
| 46 | #else |
| 47 | #define _STDINT_HAVE_U_INT_TYPES |
| 48 | #endif |
| 49 | #endif |
| 50 | #endif |
| 51 | |
| 52 | #ifdef _STDINT_HAVE_U_INT_TYPES |
| 53 | #undef _STDINT_NEED_INT_MODEL_T |
| 54 | #endif |
| 55 | |
| 56 | #ifdef _STDINT_CHAR_MODEL |
| 57 | #if _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124 |
| 58 | #ifndef _STDINT_BYTE_MODEL |
| 59 | #define _STDINT_BYTE_MODEL 12 |
| 60 | #endif |
| 61 | #endif |
| 62 | #endif |
| 63 | |
| 64 | #ifndef _STDINT_HAVE_INT_LEAST32_T |
| 65 | #define _STDINT_NEED_INT_LEAST_T |
| 66 | #endif |
| 67 | |
| 68 | #ifndef _STDINT_HAVE_INT_FAST32_T |
| 69 | #define _STDINT_NEED_INT_FAST_T |
| 70 | #endif |
| 71 | |
| 72 | #ifndef _STDINT_HEADER_INTPTR |
| 73 | #define _STDINT_NEED_INTPTR_T |
| 74 | #ifndef _STDINT_HAVE_INTMAX_T |
| 75 | #define _STDINT_NEED_INTMAX_T |
| 76 | #endif |
| 77 | #endif |
| 78 | |
| 79 | |
| 80 | /* .................... definition part ............................ */ |
| 81 | |
| 82 | /* some system headers have good uint64_t */ |
| 83 | #ifndef _HAVE_UINT64_T |
| 84 | #if defined _STDINT_HAVE_UINT64_T || defined HAVE_UINT64_T |
| 85 | #define _HAVE_UINT64_T |
| 86 | #elif defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T |
| 87 | #define _HAVE_UINT64_T |
| 88 | typedef u_int64_t uint64_t; |
| 89 | #endif |
| 90 | #endif |
| 91 | |
| 92 | #ifndef _HAVE_UINT64_T |
| 93 | /* .. here are some common heuristics using compiler runtime specifics */ |
| 94 | #if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L |
| 95 | #define _HAVE_UINT64_T |
| 96 | typedef long long int64_t; |
| 97 | typedef unsigned long long uint64_t; |
| 98 | |
| 99 | #elif !defined __STRICT_ANSI__ |
| 100 | #if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ |
| 101 | #define _HAVE_UINT64_T |
| 102 | typedef __int64 int64_t; |
| 103 | typedef unsigned __int64 uint64_t; |
| 104 | |
| 105 | #elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__ |
| 106 | /* note: all ELF-systems seem to have loff-support which needs 64-bit */ |
| 107 | #if !defined _NO_LONGLONG |
| 108 | #define _HAVE_UINT64_T |
| 109 | typedef long long int64_t; |
| 110 | typedef unsigned long long uint64_t; |
| 111 | #endif |
| 112 | |
| 113 | #elif defined __alpha || (defined __mips && defined _ABIN32) |
| 114 | #if !defined _NO_LONGLONG |
| 115 | typedef long int64_t; |
| 116 | typedef unsigned long uint64_t; |
| 117 | #endif |
| 118 | /* compiler/cpu type to define int64_t */ |
| 119 | #endif |
| 120 | #endif |
| 121 | #endif |
| 122 | |
| 123 | #if defined _STDINT_HAVE_U_INT_TYPES |
| 124 | /* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */ |
| 125 | typedef u_int8_t uint8_t; |
| 126 | typedef u_int16_t uint16_t; |
| 127 | typedef u_int32_t uint32_t; |
| 128 | |
| 129 | /* glibc compatibility */ |
| 130 | #ifndef __int8_t_defined |
| 131 | #define __int8_t_defined |
| 132 | #endif |
| 133 | #endif |
| 134 | |
| 135 | #ifdef _STDINT_NEED_INT_MODEL_T |
| 136 | /* we must guess all the basic types. Apart from byte-adressable system, */ |
| 137 | /* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */ |
| 138 | /* (btw, those nibble-addressable systems are way off, or so we assume) */ |
| 139 | |
| 140 | |
| 141 | #if defined _STDINT_BYTE_MODEL |
| 142 | #if _STDINT_LONG_MODEL+0 == 242 |
| 143 | /* 2:4:2 = IP16 = a normal 16-bit system */ |
| 144 | typedef unsigned char uint8_t; |
| 145 | typedef unsigned short uint16_t; |
| 146 | typedef unsigned long uint32_t; |
| 147 | #ifndef __int8_t_defined |
| 148 | #define __int8_t_defined |
| 149 | typedef char int8_t; |
| 150 | typedef short int16_t; |
| 151 | typedef long int32_t; |
| 152 | #endif |
| 153 | #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444 |
| 154 | /* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */ |
| 155 | /* 4:4:4 = ILP32 = a normal 32-bit system */ |
| 156 | typedef unsigned char uint8_t; |
| 157 | typedef unsigned short uint16_t; |
| 158 | typedef unsigned int uint32_t; |
| 159 | #ifndef __int8_t_defined |
| 160 | #define __int8_t_defined |
| 161 | typedef char int8_t; |
| 162 | typedef short int16_t; |
| 163 | typedef int int32_t; |
| 164 | #endif |
| 165 | #elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488 |
| 166 | /* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */ |
| 167 | /* 4:8:8 = LP64 = a normal 64-bit system */ |
| 168 | typedef unsigned char uint8_t; |
| 169 | typedef unsigned short uint16_t; |
| 170 | typedef unsigned int uint32_t; |
| 171 | #ifndef __int8_t_defined |
| 172 | #define __int8_t_defined |
| 173 | typedef char int8_t; |
| 174 | typedef short int16_t; |
| 175 | typedef int int32_t; |
| 176 | #endif |
| 177 | /* this system has a "long" of 64bit */ |
| 178 | #ifndef _HAVE_UINT64_T |
| 179 | #define _HAVE_UINT64_T |
| 180 | typedef unsigned long uint64_t; |
| 181 | typedef long int64_t; |
| 182 | #endif |
| 183 | #elif _STDINT_LONG_MODEL+0 == 448 |
| 184 | /* LLP64 a 64-bit system derived from a 32-bit system */ |
| 185 | typedef unsigned char uint8_t; |
| 186 | typedef unsigned short uint16_t; |
| 187 | typedef unsigned int uint32_t; |
| 188 | #ifndef __int8_t_defined |
| 189 | #define __int8_t_defined |
| 190 | typedef char int8_t; |
| 191 | typedef short int16_t; |
| 192 | typedef int int32_t; |
| 193 | #endif |
| 194 | /* assuming the system has a "long long" */ |
| 195 | #ifndef _HAVE_UINT64_T |
| 196 | #define _HAVE_UINT64_T |
| 197 | typedef unsigned long long uint64_t; |
| 198 | typedef long long int64_t; |
| 199 | #endif |
| 200 | #else |
| 201 | #define _STDINT_NO_INT32_T |
| 202 | #endif |
| 203 | #else |
| 204 | #define _STDINT_NO_INT8_T |
| 205 | #define _STDINT_NO_INT32_T |
| 206 | #endif |
| 207 | #endif |
| 208 | |
| 209 | /* |
| 210 | * quote from SunOS-5.8 sys/inttypes.h: |
| 211 | * Use at your own risk. As of February 1996, the committee is squarely |
| 212 | * behind the fixed sized types; the "least" and "fast" types are still being |
| 213 | * discussed. The probability that the "fast" types may be removed before |
| 214 | * the standard is finalized is high enough that they are not currently |
| 215 | * implemented. |
| 216 | */ |
| 217 | |
| 218 | #if defined _STDINT_NEED_INT_LEAST_T |
| 219 | typedef int8_t int_least8_t; |
| 220 | typedef int16_t int_least16_t; |
| 221 | typedef int32_t int_least32_t; |
| 222 | #ifdef _HAVE_UINT64_T |
| 223 | typedef int64_t int_least64_t; |
| 224 | #endif |
| 225 | |
| 226 | typedef uint8_t uint_least8_t; |
| 227 | typedef uint16_t uint_least16_t; |
| 228 | typedef uint32_t uint_least32_t; |
| 229 | #ifdef _HAVE_UINT64_T |
| 230 | typedef uint64_t uint_least64_t; |
| 231 | #endif |
| 232 | /* least types */ |
| 233 | #endif |
| 234 | |
| 235 | #if defined _STDINT_NEED_INT_FAST_T |
| 236 | typedef int8_t int_fast8_t; |
| 237 | typedef int int_fast16_t; |
| 238 | typedef int32_t int_fast32_t; |
| 239 | #ifdef _HAVE_UINT64_T |
| 240 | typedef int64_t int_fast64_t; |
| 241 | #endif |
| 242 | |
| 243 | typedef uint8_t uint_fast8_t; |
| 244 | typedef unsigned uint_fast16_t; |
| 245 | typedef uint32_t uint_fast32_t; |
| 246 | #ifdef _HAVE_UINT64_T |
| 247 | typedef uint64_t uint_fast64_t; |
| 248 | #endif |
| 249 | /* fast types */ |
| 250 | #endif |
| 251 | |
| 252 | #ifdef _STDINT_NEED_INTMAX_T |
| 253 | #ifdef _HAVE_UINT64_T |
| 254 | typedef int64_t intmax_t; |
| 255 | typedef uint64_t uintmax_t; |
| 256 | #else |
| 257 | typedef long intmax_t; |
| 258 | typedef unsigned long uintmax_t; |
| 259 | #endif |
| 260 | #endif |
| 261 | |
| 262 | #ifdef _STDINT_NEED_INTPTR_T |
| 263 | #ifndef __intptr_t_defined |
| 264 | #define __intptr_t_defined |
| 265 | /* we encourage using "long" to store pointer values, never use "int" ! */ |
| 266 | #if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484 |
| 267 | typedef unsigned int uintptr_t; |
| 268 | typedef int intptr_t; |
| 269 | #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444 |
| 270 | typedef unsigned long uintptr_t; |
| 271 | typedef long intptr_t; |
| 272 | #elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T |
| 273 | typedef uint64_t uintptr_t; |
| 274 | typedef int64_t intptr_t; |
| 275 | #else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */ |
| 276 | typedef unsigned long uintptr_t; |
| 277 | typedef long intptr_t; |
| 278 | #endif |
| 279 | #endif |
| 280 | #endif |
| 281 | |
| 282 | /* shortcircuit*/ |
| 283 | #endif |
| 284 | /* once */ |
| 285 | #endif |
| 286 | #endif |
| 287 | |