1228072Sbapt/* flex integer type definitions */ 2228072Sbapt 3228072Sbapt#ifndef FLEXINT_H 4228072Sbapt#define FLEXINT_H 5228072Sbapt 6228072Sbapt/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 7228072Sbapt 8250875Sjkim#if defined(__FreeBSD__) || \ 9250875Sjkim (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) 10228072Sbapt 11228072Sbapt/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 12228072Sbapt * if you want the limit (max/min) macros for int types. 13228072Sbapt */ 14228072Sbapt#ifndef __STDC_LIMIT_MACROS 15228072Sbapt#define __STDC_LIMIT_MACROS 1 16228072Sbapt#endif 17228072Sbapt 18228072Sbapt#include <inttypes.h> 19228072Sbapttypedef int8_t flex_int8_t; 20228072Sbapttypedef uint8_t flex_uint8_t; 21228072Sbapttypedef int16_t flex_int16_t; 22228072Sbapttypedef uint16_t flex_uint16_t; 23228072Sbapttypedef int32_t flex_int32_t; 24228072Sbapttypedef uint32_t flex_uint32_t; 25228072Sbapt#else 26228072Sbapttypedef signed char flex_int8_t; 27228072Sbapttypedef short int flex_int16_t; 28228072Sbapttypedef int flex_int32_t; 29228072Sbapttypedef unsigned char flex_uint8_t; 30228072Sbapttypedef unsigned short int flex_uint16_t; 31228072Sbapttypedef unsigned int flex_uint32_t; 32228072Sbapt 33228072Sbapt/* Limits of integral types. */ 34228072Sbapt#ifndef INT8_MIN 35228072Sbapt#define INT8_MIN (-128) 36228072Sbapt#endif 37228072Sbapt#ifndef INT16_MIN 38228072Sbapt#define INT16_MIN (-32767-1) 39228072Sbapt#endif 40228072Sbapt#ifndef INT32_MIN 41228072Sbapt#define INT32_MIN (-2147483647-1) 42228072Sbapt#endif 43228072Sbapt#ifndef INT8_MAX 44228072Sbapt#define INT8_MAX (127) 45228072Sbapt#endif 46228072Sbapt#ifndef INT16_MAX 47228072Sbapt#define INT16_MAX (32767) 48228072Sbapt#endif 49228072Sbapt#ifndef INT32_MAX 50228072Sbapt#define INT32_MAX (2147483647) 51228072Sbapt#endif 52228072Sbapt#ifndef UINT8_MAX 53228072Sbapt#define UINT8_MAX (255U) 54228072Sbapt#endif 55228072Sbapt#ifndef UINT16_MAX 56228072Sbapt#define UINT16_MAX (65535U) 57228072Sbapt#endif 58228072Sbapt#ifndef UINT32_MAX 59228072Sbapt#define UINT32_MAX (4294967295U) 60228072Sbapt#endif 61228072Sbapt 62250125Sjkim#endif /* ! C99 */ 63228072Sbapt 64228072Sbapt#endif /* ! FLEXINT_H */ 65