1 /* 2 * Part 2 of template for caida_t.h. This is a separate file so it can be 3 * included by a ./configure test for integer formats before ./configure has 4 * generated caida_t.h. The original form of this file must be valid C. 5 * During the configure test, the HAVE macros are defined automatically by 6 * AC_TRY_RUN; in normal usage, this file is embedded in caida_t.h, and the 7 * HAVE macros are defined by part 1, which was generated from caida_t.1.in. 8 */ 9 10 #if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) 11 # define __STDC_FORMAT_MACROS /* Makes <inttypes.h> in C++ define fmt macros */ 12 #endif 13 14 #if (HAVE_INTTYPES_H) 15 #include <inttypes.h> 16 #endif 17 18 #if (HAVE_STDINT_H) 19 #include <stdint.h> 20 #endif 21 22 #if (HAVE_MACHINE_TYPES_H) 23 #include <machine/types.h> 24 #endif 25 26 #if (HAVE_SYS_TYPES_H) 27 #include <sys/types.h> 28 #endif 29 30 #if (HAVE_UINT8_T == 0) 31 typedef unsigned char uint8_t; 32 #endif 33 34 #if (HAVE_INT8_T == 0) 35 typedef signed char int8_t; 36 #endif 37 38 #if (HAVE_UINT16_T == 0) 39 #if (HAVE_U_INT16_T) 40 typedef u_int16_t uint16_t; 41 #elif (SIZEOF_SHORT == 2) 42 typedef unsigned short uint16_t; 43 #endif 44 #endif 45 46 #if (HAVE_INT16_T == 0) 47 #if (SIZEOF_SHORT == 2) 48 typedef short int16_t; 49 #endif 50 #endif 51 52 #if (HAVE_UINT32_T == 0) 53 #if (HAVE_U_INT32_T) 54 typedef u_int32_t uint32_t; 55 #elif (SIZEOF_INT == 4) 56 typedef unsigned int uint32_t; 57 #elif (SIZEOF_LONG == 4) 58 typedef unsigned long uint32_t; 59 #endif 60 #endif 61 62 #if (HAVE_INT32_T == 0) 63 #if (SIZEOF_INT == 4) 64 typedef int int32_t; 65 #elif (SIZEOF_LONG == 4) 66 typedef long int32_t; 67 #endif 68 #endif 69 70 #if (HAVE_UINT64_T == 0) 71 #if (HAVE_U_INT64_T) 72 typedef u_int64_t uint64_t; 73 #elif (SIZEOF_LONG_LONG == 8) 74 typedef unsigned long long uint64_t; 75 #endif 76 #endif 77 78 #if (HAVE_INT64_T == 0) 79 #if (SIZEOF_LONG_LONG == 8) 80 typedef long long int64_t; 81 #endif 82 #endif 83 84 #ifndef UINT16_MAX 85 # define UINT16_MAX 0xFFFF 86 #endif 87 #ifndef INT16_MAX 88 # define INT16_MAX 0x7FFF 89 #endif 90 91 #ifndef UINT32_MAX 92 # define UINT32_MAX 0xFFFFFFFFul 93 #endif 94 #ifndef INT32_MAX 95 # define INT32_MAX 0x7FFFFFFFl 96 #endif 97 98 #ifndef UINT64_MAX 99 # define UINT64_MAX 0xFFFFFFFFFFFFFFFFull 100 #endif 101 #ifndef UINT64_MAX 102 # define UINT64_MAX 0x7FFFFFFFFFFFFFFFll 103 #endif 104