# HG changeset patch # User Matti Hamalainen # Date 1578586649 -7200 # Node ID ebdfc1fe1c98daff9b656d86609d8e1121303962 # Parent 872d2a65ce566fad63e0a09242144b1b39a71d70 Fixes to the type definitions. diff -r 872d2a65ce56 -r ebdfc1fe1c98 th_types.h --- a/th_types.h Thu Jan 09 17:59:30 2020 +0200 +++ b/th_types.h Thu Jan 09 18:17:29 2020 +0200 @@ -24,21 +24,17 @@ // Check for standard headers -#if defined(HAVE_STDINT_H) +#if defined(HAVE_INTTYPES_H) +# include +# ifndef HAVE_STDINT_H +# define HAVE_STDINT_H 1 +# endif +#elif defined(HAVE_STDINT_H) # include -# ifndef HAVE_INT_TYPES -# define HAVE_INT_TYPES 1 -# endif #elif defined(HAVE_SYS_TYPES_H) # include -# ifndef HAVE_INT_TYPES -# define HAVE_INT_TYPES 1 -# endif #endif -#ifdef HAVE_INTTYPES_H -# include -#endif // Check for arch bitness @@ -123,51 +119,18 @@ #endif -// Shorthand types -typedef unsigned long int ulint_t; -typedef signed long int lint_t; -#ifndef HAVE_UINT_T // BOOST defines uint_t at least -typedef unsigned int uint_t; -#endif - -/* Default assumptions for these types should be ok for most 32bit platforms... - * feel free to define TH_TYPE_* if necessary to remedy +/* Default assumptions for these types should be ok for most 32/64bit platforms... */ -#ifdef TH_TYPE_I8 -typedef unsigned TH_TYPE_I8 uint8_t; // 8 bits, unsigned -typedef signed TH_TYPE_I8 int8_t; // 8 bits, signed -#elif !defined(HAVE_INT_TYPES) +#ifndef HAVE_STDINT_H typedef unsigned char uint8_t; typedef signed char int8_t; -#endif - - -#ifdef TH_TYPE_I16 -typedef unsigned TH_TYPE_I16 uint16_t; // 16 bits, unsigned == 2 BYTEs -typedef signed TH_TYPE_I16 int16_t; // 16 bits, signed -#elif !defined(HAVE_INT_TYPES) typedef unsigned short int uint16_t; typedef signed short int int16_t; -#endif - -#ifdef TH_TYPE_I32 -typedef unsigned TH_TYPE_I32 uint32_t; // 32 bits, unsigned == 4 BYTES == 2 WORDs -typedef signed TH_TYPE_I32 int32_t; // 32 bits, signed -#elif !defined(HAVE_INT_TYPES) typedef unsigned int uint32_t; typedef signed int int32_t; -#endif - -#ifdef TH_TYPE_I64 -typedef unsigned TH_TYPE_I64 uint64_t; // 64 bits, unsigned == 8 BYTES == 2 DWORDs -typedef signed TH_TYPE_I64 int64_t; // 64 bits, signed -#elif !defined(HAVE_INT_TYPES) typedef unsigned long long uint64_t; typedef signed long long int64_t; -#endif - -#ifndef HAVE_INT_TYPES #if TH_ARCH == 32 typedef long long int intmax_t; typedef unsigned long long int uintmax_t;