Mercurial > hg > th-libs
changeset 575:ebdfc1fe1c98
Fixes to the type definitions.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 09 Jan 2020 18:17:29 +0200 |
parents | 872d2a65ce56 |
children | e4ae9ef86332 |
files | th_types.h |
diffstat | 1 files changed, 8 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- 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 <inttypes.h> +# ifndef HAVE_STDINT_H +# define HAVE_STDINT_H 1 +# endif +#elif defined(HAVE_STDINT_H) # include <stdint.h> -# ifndef HAVE_INT_TYPES -# define HAVE_INT_TYPES 1 -# endif #elif defined(HAVE_SYS_TYPES_H) # include <sys/types.h> -# ifndef HAVE_INT_TYPES -# define HAVE_INT_TYPES 1 -# endif #endif -#ifdef HAVE_INTTYPES_H -# include <inttypes.h> -#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;