3 * This header file ensures that we have u_int<n>_t types of the proper width,
4 * using a rather convoluted set of conditionals generated by configure. This
5 * is an almighty pain in the arse, and is completely irrelevant on most
6 * systems which already define this stuff.
8 * $Id: integers.h,v 1.1 2002/11/04 12:28:43 chris Exp $
12 #ifndef __INTEGERS_H_ /* include guard */
15 #include <sys/types.h>
18 #if SIZEOF_U_INT8_T != 1 || SIZEOF_U_INT16_T != 2 || SIZEOF_U_INT32_T != 4
20 # if defined(HAVE_C99_INTS)
23 * Use the C99 standard-width integers, defined in some appropriate
27 # if defined(HAVE_STDINT_H)
29 # elif defined(HAVE_SYS_INTTYPES_H)
30 # include <sys/inttypes.h>
33 /* Don't replace existing u_int<n>_t types. */
34 # if SIZEOF_U_INT8_T != 1
35 typedef uint8_t u_int8_t;
38 # if SIZEOF_U_INT16_T != 2
39 typedef uint16_t u_int16_t;
42 # if SIZEOF_U_INT32_T != 4
43 typedef uint32_t u_int32_t;
46 # elif (SIZEOF_UNSIGNED_SHORT_INT == 2 || SIZEOF_UNSIGNED_INT == 2) \
47 && (SIZEOF_UNSIGNED_INT == 4 || SIZEOF_UNSIGNED_LONG_INT == 4)
50 * Use an appropriately-sized basic type.
53 # if SIZEOF_U_INT8_T != 1
54 typedef unsigned char u_int8_t; /* By definition. */
57 # if SIZEOF_U_INT16_T != 2
58 # if SIZEOF_UNSIGNED_SHORT_INT == 2
59 typedef unsigned short int u_int16_t;
60 # elif SIZEOF_UNSIGNED_INT == 2
61 typedef unsigned int u_int16_t; /* Not likely. */
65 # if SIZEOF_U_INT32_T != 4
66 # if SIZEOF_UNSIGNED_INT == 4
67 typedef unsigned int u_int32_t;
68 # elif SIZEOF_UNSIGNED_LONG_INT == 4
69 typedef unsigned long int u_int32_t;
76 # error "Your C compiler seems to lack 16 and 32 bit unsigned integer types"
79 #endif /* No existing u_int<n>_t types. */
81 #endif /* __INTEGERS_H_ */