1 /* flex integer type definitions */ 2 3 #ifndef FLEXINT_H 4 #define FLEXINT_H 5 6 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 7 8 #if defined(__FreeBSD__) || \ 9 (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) 10 11 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 12 * if you want the limit (max/min) macros for int types. 13 */ 14 #ifndef __STDC_LIMIT_MACROS 15 #define __STDC_LIMIT_MACROS 1 16 #endif 17 18 #include <inttypes.h> 19 typedef int8_t flex_int8_t; 20 typedef uint8_t flex_uint8_t; 21 typedef int16_t flex_int16_t; 22 typedef uint16_t flex_uint16_t; 23 typedef int32_t flex_int32_t; 24 typedef uint32_t flex_uint32_t; 25 #else 26 typedef signed char flex_int8_t; 27 typedef short int flex_int16_t; 28 typedef int flex_int32_t; 29 typedef unsigned char flex_uint8_t; 30 typedef unsigned short int flex_uint16_t; 31 typedef unsigned int flex_uint32_t; 32 33 /* Limits of integral types. */ 34 #ifndef INT8_MIN 35 #define INT8_MIN (-128) 36 #endif 37 #ifndef INT16_MIN 38 #define INT16_MIN (-32767-1) 39 #endif 40 #ifndef INT32_MIN 41 #define INT32_MIN (-2147483647-1) 42 #endif 43 #ifndef INT8_MAX 44 #define INT8_MAX (127) 45 #endif 46 #ifndef INT16_MAX 47 #define INT16_MAX (32767) 48 #endif 49 #ifndef INT32_MAX 50 #define INT32_MAX (2147483647) 51 #endif 52 #ifndef UINT8_MAX 53 #define UINT8_MAX (255U) 54 #endif 55 #ifndef UINT16_MAX 56 #define UINT16_MAX (65535U) 57 #endif 58 #ifndef UINT32_MAX 59 #define UINT32_MAX (4294967295U) 60 #endif 61 62 #ifndef SIZE_MAX 63 #define SIZE_MAX (~(size_t)0) 64 #endif 65 66 #endif /* ! C99 */ 67 68 #endif /* ! FLEXINT_H */ 69