forked from ldmud/ldmud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy-stdint.h
49 lines (40 loc) · 1.14 KB
/
my-stdint.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef MY_STDINT_H__
#define MY_STDINT_H__
/*------------------------------------------------------------------
* Portable definition of the subset of stdint.h we need.
*------------------------------------------------------------------
*/
#include "driver.h"
#if defined(HAVE_STDINT_H)
# include <stdint.h>
#elif defined(HAVE_INTTYPES_H)
# include <inttypes.h>
# define NEED_LEAST16_T
#elif defined(HAVE_INTTYPES)
# include <sys/types.h>
# define NEED_LEAST16_T
#else
# define NEED_LEAST16_T
# if SIZEOF_LONG == 4
typedef unsigned long uint32_t;
# elif SIZEOF_INT == 4
typedef unsigned int uint32_t;
# else
# error "No suitable integer type found for uint32_t."
# endif
# if CHAR_BIT == 8
typedef unsigned char uint8_t;
# else
# error "No suitable integer type found for uint8_t."
# endif
#endif /* HAVE_STDINT_H */
#if defined(NEED_LEAST16_T)
# if SIZEOF_LONG == 2
typedef long int_least16_t;
# elif SIZEOF_SHORT == 2
typedef short int_least16_t;
# else
# error "No suitable integer type found for int_least16_t."
# endif
#endif /* NEED_LEAST16_T */
#endif /* MY_STDINT_H__ */