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