1 /* 2 *--------------------------------------------------------------------- 3 * loctypes.h --- determine what to use for 4 and 8 byte integers. 4 * Specifically, time units in IRSIM need to be 8 byte unsigned. 5 *--------------------------------------------------------------------- 6 */ 7 8 #ifndef _LOCTYPES_H 9 #define _LOCTYPES_H 10 11 /* Ulong is intended to be an 8-byte integer. Systems which have type */ 12 /* "long" defined as 4 bytes (e.g., Linux) should define Ulong as type */ 13 /* "unsigned long long". */ 14 15 #ifdef HAVE_LIMITS_H 16 #include <limits.h> 17 #else 18 #ifdef HAVE_SYS_PARAM_H 19 #include <sys/param.h> 20 #endif 21 #endif 22 23 #if defined(LONG_MAX) && defined(INT_MAX) 24 #if LONG_MAX == INT_MAX 25 typedef long long dlong; 26 typedef unsigned long long Ulong; 27 #define strtoUlong strtoull 28 #define PRINTF_LLONG "%ll" 29 #else 30 typedef long dlong; 31 typedef unsigned long Ulong; 32 #define strtoUlong strtoul 33 #define PRINTF_LLONG "%l" 34 #endif 35 #else 36 typedef long long dlong; 37 typedef unsigned long long Ulong; 38 #define strtoUlong strtoull 39 #define PRINTF_LLONG "%ll" 40 #endif 41 42 typedef unsigned int Uint; 43 typedef unsigned char Uchar; 44 typedef char *uptr; 45 typedef int (*ifun)(); 46 typedef void (*vfun)(); 47 typedef uptr (*ufun)(); 48 49 #if SIZEOF_VOID_P == SIZEOF_UNSIGNED_INT 50 typedef Uint pointertype; 51 #elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG 52 typedef Ulong pointertype; 53 #else 54 ERROR: Cannot compile without knowing the size of a pointer. See base/net.h 55 #endif 56 57 58 #endif /* _LOCTYPES_H */ 59