diff options
Diffstat (limited to 'src/H5public.h')
-rw-r--r-- | src/H5public.h | 124 |
1 files changed, 67 insertions, 57 deletions
diff --git a/src/H5public.h b/src/H5public.h index 93cb2ea..68f6e02 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -177,42 +177,82 @@ typedef long long ssize_t; #endif #endif +/* int64_t type is used for creation order field for links. It may be + * defined in Posix.1g, otherwise it is defined here. + */ +#if H5_SIZEOF_INT64_T>=8 +#elif H5_SIZEOF_INT>=8 + typedef int int64_t; +# undef H5_SIZEOF_INT64_T +# define H5_SIZEOF_INT64_T H5_SIZEOF_INT +#elif H5_SIZEOF_LONG>=8 + typedef long int64_t; +# undef H5_SIZEOF_INT64_T +# define H5_SIZEOF_INT64_T H5_SIZEOF_LONG +#elif H5_SIZEOF_LONG_LONG>=8 + typedef long long int64_t; +# undef H5_SIZEOF_INT64_T +# define H5_SIZEOF_INT64_T H5_SIZEOF_LONG_LONG +#else +# error "nothing appropriate for int64_t" +#endif + +/* uint64_t type is used for fields for H5O_info_t. It may be + * defined in Posix.1g, otherwise it is defined here. + */ +#if H5_SIZEOF_UINT64_T>=8 +#elif H5_SIZEOF_INT>=8 + typedef unsigned uint64_t; +# undef H5_SIZEOF_UINT64_T +# define H5_SIZEOF_UINT64_T H5_SIZEOF_INT +#elif H5_SIZEOF_LONG>=8 + typedef unsigned long uint64_t; +# undef H5_SIZEOF_UINT64_T +# define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG +#elif H5_SIZEOF_LONG_LONG>=8 + typedef unsigned long long uint64_t; +# undef H5_SIZEOF_UINT64_T +# define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG_LONG +#else +# error "nothing appropriate for uint64_t" +#endif + /* * The sizes of file objects have their own types defined here, use a 64-bit * type. */ -#if H5_SIZEOF_LONG_LONG >= 8 -H5_GCC_DIAG_OFF(long-long) -typedef unsigned long long hsize_t; -typedef signed long long hssize_t; -H5_GCC_DIAG_ON(long-long) -# define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG -# define H5_SIZEOF_HSSIZE_T H5_SIZEOF_LONG_LONG -#else -# error "nothing appropriate for hsize_t" -#endif -#define HSIZE_UNDEF ((hsize_t)(hssize_t)(-1)) +typedef uint64_t hsize_t; +typedef int64_t hssize_t; +#define PRIXHSIZE PRIX64 +#define PRIdHSIZE PRId64 +#define PRIiHSIZE PRIi64 +#define PRIoHSIZE PRIo64 +#define PRIuHSIZE PRIu64 +#define PRIxHSIZE PRIx64 +#define H5_SIZEOF_HSIZE_T H5_SIZEOF_UINT64_T +#define H5_SIZEOF_HSSIZE_T H5_SIZEOF_INT64_T +#define HSIZE_UNDEF UINT64_MAX /* * File addresses have their own types. */ #if H5_SIZEOF_INT >= 8 typedef unsigned haddr_t; -# define HADDR_UNDEF ((haddr_t)(-1)) +# define HADDR_UNDEF UINT_MAX # define H5_SIZEOF_HADDR_T H5_SIZEOF_INT # ifdef H5_HAVE_PARALLEL # define HADDR_AS_MPI_TYPE MPI_UNSIGNED # endif /* H5_HAVE_PARALLEL */ #elif H5_SIZEOF_LONG >= 8 typedef unsigned long haddr_t; -# define HADDR_UNDEF ((haddr_t)(long)(-1)) +# define HADDR_UNDEF ULONG_MAX # define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG # ifdef H5_HAVE_PARALLEL # define HADDR_AS_MPI_TYPE MPI_UNSIGNED_LONG # endif /* H5_HAVE_PARALLEL */ #elif H5_SIZEOF_LONG_LONG >= 8 typedef unsigned long long haddr_t; -# define HADDR_UNDEF ((haddr_t)(long long)(-1)) +# define HADDR_UNDEF ULLONG_MAX # define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG_LONG # ifdef H5_HAVE_PARALLEL # define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT @@ -221,14 +261,24 @@ H5_GCC_DIAG_ON(long-long) # error "nothing appropriate for haddr_t" #endif #if H5_SIZEOF_HADDR_T == H5_SIZEOF_INT -# define H5_PRINTF_HADDR_FMT "%u" +# define PRIXHADDR "X" +# define PRIoHADDR "o" +# define PRIuHADDR "u" +# define PRIxHADDR "x" #elif H5_SIZEOF_HADDR_T == H5_SIZEOF_LONG -# define H5_PRINTF_HADDR_FMT "%lu" +# define PRIXHADDR "lX" +# define PRIoHADDR "lo" +# define PRIuHADDR "lu" +# define PRIxHADDR "lx" #elif H5_SIZEOF_HADDR_T == H5_SIZEOF_LONG_LONG -# define H5_PRINTF_HADDR_FMT "%" H5_PRINTF_LL_WIDTH "u" +# define PRIXHADDR H5_PRINTF_LL_WIDTH "X" +# define PRIoHADDR H5_PRINTF_LL_WIDTH "o" +# define PRIuHADDR H5_PRINTF_LL_WIDTH "u" +# define PRIxHADDR H5_PRINTF_LL_WIDTH "x" #else # error "nothing appropriate for H5_PRINTF_HADDR_FMT" #endif +#define H5_PRINTF_HADDR_FMT "%" PRIuHADDR #define HADDR_MAX (HADDR_UNDEF-1) /* uint32_t type is used for creation order field for messages. It may be @@ -251,46 +301,6 @@ H5_GCC_DIAG_ON(long-long) # error "nothing appropriate for uint32_t" #endif -/* int64_t type is used for creation order field for links. It may be - * defined in Posix.1g, otherwise it is defined here. - */ -#if H5_SIZEOF_INT64_T>=8 -#elif H5_SIZEOF_INT>=8 - typedef int int64_t; -# undef H5_SIZEOF_INT64_T -# define H5_SIZEOF_INT64_T H5_SIZEOF_INT -#elif H5_SIZEOF_LONG>=8 - typedef long int64_t; -# undef H5_SIZEOF_INT64_T -# define H5_SIZEOF_INT64_T H5_SIZEOF_LONG -#elif H5_SIZEOF_LONG_LONG>=8 - typedef long long int64_t; -# undef H5_SIZEOF_INT64_T -# define H5_SIZEOF_INT64_T H5_SIZEOF_LONG_LONG -#else -# error "nothing appropriate for int64_t" -#endif - -/* uint64_t type is used for fields for H5O_info_t. It may be - * defined in Posix.1g, otherwise it is defined here. - */ -#if H5_SIZEOF_UINT64_T>=8 -#elif H5_SIZEOF_INT>=8 - typedef unsigned uint64_t; -# undef H5_SIZEOF_UINT64_T -# define H5_SIZEOF_UINT64_T H5_SIZEOF_INT -#elif H5_SIZEOF_LONG>=8 - typedef unsigned long uint64_t; -# undef H5_SIZEOF_UINT64_T -# define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG -#elif H5_SIZEOF_LONG_LONG>=8 - typedef unsigned long long uint64_t; -# undef H5_SIZEOF_UINT64_T -# define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG_LONG -#else -# error "nothing appropriate for uint64_t" -#endif - /* Common iteration orders */ typedef enum { H5_ITER_UNKNOWN = -1, /* Unknown order */ |