mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[svn-r26258] Description:
Remove LDOUBLE_TO_INTEGER_WORKS macro/define from configure/library/tests, since it was added to support non-standard behavior on SGI IRIX & HP-UX, which we don't support any longer. Tested on: Mac OSX/64 10.10.2 (amazon) w/serial & parallel (h5committest not required on this branch)
This commit is contained in:
parent
707965be8a
commit
c52835f4c1
@ -258,15 +258,6 @@ ENDMACRO (H5MiscConversionTest)
|
||||
# Check various conversion capabilities
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# Set flag to indicate that the machine can do conversion from
|
||||
# long double to integers regardless of accuracy. This flag should be
|
||||
# set "yes" for all machines except HP-UX 11.00. For HP-UX 11.00, the
|
||||
# compiler has 'floating exception' when converting 'long double' to all
|
||||
# integers except 'unsigned long long'. Other HP-UX systems are unknown
|
||||
# yet. (1/8/05 - SLU)
|
||||
#
|
||||
H5ConversionTests (H5_LDOUBLE_TO_INTEGER_WORKS "Checking IF converting from long double to integers works")
|
||||
# -----------------------------------------------------------------------
|
||||
# Set flag to indicate that the machine can handle conversion from
|
||||
# integers to long double. (This flag should be set "yes" for all
|
||||
|
@ -61,35 +61,6 @@ done:
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef H5_LDOUBLE_TO_INTEGER_WORKS_TEST
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void *align;
|
||||
long double ld= 9701917572145405952.00L;
|
||||
unsigned char v1;
|
||||
short v2;
|
||||
unsigned int v3;
|
||||
int ret = 0;
|
||||
|
||||
align = (void*)malloc(sizeof(long double));
|
||||
memcpy(align, &ld, sizeof(long double));
|
||||
|
||||
/*For HU-UX11.00, there's floating exception(core dump) when doing some of casting
|
||||
*from 'long double' to integers*/
|
||||
v1=(unsigned char)(*((long double*)align));
|
||||
v2=(short)(*((long double*)align));
|
||||
v3=(unsigned int)(*((long double*)align));
|
||||
|
||||
done:
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef H5_LDOUBLE_TO_LLONG_ACCURATE_TEST
|
||||
int main(void)
|
||||
{
|
||||
|
@ -460,9 +460,6 @@
|
||||
values. */
|
||||
#cmakedefine H5_INTEGER_TO_LDOUBLE_ACCURATE @H5_INTEGER_TO_LDOUBLE_ACCURATE@
|
||||
|
||||
/* Define if your system can convert from long double to integer values. */
|
||||
#cmakedefine H5_LDOUBLE_TO_INTEGER_WORKS @H5_LDOUBLE_TO_INTEGER_WORKS@
|
||||
|
||||
/* Define if your system can convert long double to (unsigned) long long
|
||||
values correctly. */
|
||||
#cmakedefine H5_LDOUBLE_TO_LLONG_ACCURATE @H5_LDOUBLE_TO_LLONG_ACCURATE@
|
||||
|
47
configure.ac
47
configure.ac
@ -2574,53 +2574,6 @@ case "`uname`" in
|
||||
;;
|
||||
esac
|
||||
|
||||
## -----------------------------------------------------------------------
|
||||
## Set flag to indicate that the machine can do conversion from
|
||||
## long double to integers regardless of accuracy. This flag should be
|
||||
## set "yes" for all machines except HP-UX 11.00. For HP-UX 11.00, the
|
||||
## compiler has 'floating exception' when converting 'long double' to all
|
||||
## integers except 'unsigned long long'. Other HP-UX systems are unknown
|
||||
## yet. (1/8/05 - SLU)
|
||||
|
||||
AC_MSG_CHECKING([if converting from long double to integers works])
|
||||
|
||||
if test ${ac_cv_sizeof_long_double} = 0; then
|
||||
hdf5_cv_ldouble_to_integer_works=${hdf5_cv_ldouble_to_integer_works=no}
|
||||
else
|
||||
AC_CACHE_VAL([hdf5_cv_ldouble_to_integer_works],
|
||||
[AC_TRY_RUN([
|
||||
int main(void)
|
||||
{
|
||||
void *align;
|
||||
long double ld= 9701917572145405952.00L;
|
||||
unsigned char v1;
|
||||
short v2;
|
||||
unsigned int v3;
|
||||
int ret = 0;
|
||||
|
||||
align = (void*)malloc(sizeof(long double));
|
||||
memcpy(align, &ld, sizeof(long double));
|
||||
|
||||
/*For HU-UX11.00, there's floating exception(core dump) when doing some of casting
|
||||
*from 'long double' to integers*/
|
||||
v1=(unsigned char)(*((long double*)align));
|
||||
v2=(short)(*((long double*)align));
|
||||
v3=(unsigned int)(*((long double*)align));
|
||||
|
||||
done:
|
||||
exit(ret);
|
||||
}
|
||||
], [hdf5_cv_ldouble_to_integer_works=yes], [hdf5_cv_ldouble_to_integer_works=no],)])
|
||||
fi
|
||||
|
||||
if test ${hdf5_cv_ldouble_to_integer_works} = "yes"; then
|
||||
AC_DEFINE([LDOUBLE_TO_INTEGER_WORKS], [1],
|
||||
[Define if your system can convert from long double to integer values.])
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
## -----------------------------------------------------------------------
|
||||
## Set flag to indicate that the machine can handle conversion from
|
||||
## integers to long double. (This flag should be set "yes" for all
|
||||
|
14
src/H5T.c
14
src/H5T.c
@ -1263,37 +1263,27 @@ H5T_init_interface(void)
|
||||
/* From floats to char */
|
||||
status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T__conv_float_schar, H5AC_dxpl_id, FALSE);
|
||||
status |= H5T_register(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T__conv_double_schar, H5AC_dxpl_id, FALSE);
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
status |= H5T_register(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T__conv_ldouble_schar, H5AC_dxpl_id, FALSE);
|
||||
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
|
||||
|
||||
/* From floats to unsigned char */
|
||||
status |= H5T_register(H5T_PERS_HARD, "flt_uchar", native_float, native_uchar, H5T__conv_float_uchar, H5AC_dxpl_id, FALSE);
|
||||
status |= H5T_register(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T__conv_double_uchar, H5AC_dxpl_id, FALSE);
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
status |= H5T_register(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T__conv_ldouble_uchar, H5AC_dxpl_id, FALSE);
|
||||
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
|
||||
|
||||
/* From floats to short */
|
||||
status |= H5T_register(H5T_PERS_HARD, "flt_short", native_float, native_short, H5T__conv_float_short, H5AC_dxpl_id, FALSE);
|
||||
status |= H5T_register(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T__conv_double_short, H5AC_dxpl_id, FALSE);
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
status |= H5T_register(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T__conv_ldouble_short, H5AC_dxpl_id, FALSE);
|
||||
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
|
||||
|
||||
/* From floats to unsigned short */
|
||||
status |= H5T_register(H5T_PERS_HARD, "flt_ushort", native_float, native_ushort, H5T__conv_float_ushort, H5AC_dxpl_id, FALSE);
|
||||
status |= H5T_register(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T__conv_double_ushort, H5AC_dxpl_id, FALSE);
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
status |= H5T_register(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T__conv_ldouble_ushort, H5AC_dxpl_id, FALSE);
|
||||
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
|
||||
|
||||
/* From floats to int */
|
||||
status |= H5T_register(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T__conv_float_int, H5AC_dxpl_id, FALSE);
|
||||
status |= H5T_register(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T__conv_double_int, H5AC_dxpl_id, FALSE);
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
status |= H5T_register(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T__conv_ldouble_int, H5AC_dxpl_id, FALSE);
|
||||
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
|
||||
|
||||
/* From floats to unsigned int */
|
||||
status |= H5T_register(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T__conv_float_uint, H5AC_dxpl_id, FALSE);
|
||||
@ -1304,16 +1294,12 @@ H5T_init_interface(void)
|
||||
|
||||
status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long, H5AC_dxpl_id, FALSE);
|
||||
status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long, H5AC_dxpl_id, FALSE);
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long, H5AC_dxpl_id, FALSE);
|
||||
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
|
||||
|
||||
/* From floats to unsigned long */
|
||||
status |= H5T_register(H5T_PERS_HARD, "flt_ulong", native_float, native_ulong, H5T__conv_float_ulong, H5AC_dxpl_id, FALSE);
|
||||
status |= H5T_register(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T__conv_double_ulong, H5AC_dxpl_id, FALSE);
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
status |= H5T_register(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T__conv_ldouble_ulong, H5AC_dxpl_id, FALSE);
|
||||
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
|
||||
|
||||
/* From floats to long long */
|
||||
#if H5T_CONV_INTERNAL_FP_LLONG
|
||||
|
@ -8141,7 +8141,6 @@ H5_GCC_DIAG_ON(float-equal)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
herr_t
|
||||
H5T__conv_ldouble_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, size_t buf_stride,
|
||||
@ -8152,7 +8151,6 @@ H5_GCC_DIAG_OFF(float-equal)
|
||||
H5T_CONV_Fx(LDOUBLE, SCHAR, long double, signed char, SCHAR_MIN, SCHAR_MAX);
|
||||
H5_GCC_DIAG_ON(float-equal)
|
||||
}
|
||||
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -8170,7 +8168,6 @@ H5_GCC_DIAG_ON(float-equal)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
herr_t
|
||||
H5T__conv_ldouble_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, size_t buf_stride,
|
||||
@ -8181,7 +8178,6 @@ H5_GCC_DIAG_OFF(float-equal)
|
||||
H5T_CONV_Fx(LDOUBLE, UCHAR, long double, unsigned char, 0, UCHAR_MAX);
|
||||
H5_GCC_DIAG_ON(float-equal)
|
||||
}
|
||||
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -8307,7 +8303,6 @@ H5_GCC_DIAG_ON(float-equal)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
herr_t
|
||||
H5T__conv_ldouble_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, size_t buf_stride,
|
||||
@ -8318,7 +8313,6 @@ H5_GCC_DIAG_OFF(float-equal)
|
||||
H5T_CONV_Fx(LDOUBLE, SHORT, long double, short, SHRT_MIN, SHRT_MAX);
|
||||
H5_GCC_DIAG_ON(float-equal)
|
||||
}
|
||||
#endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -8336,7 +8330,6 @@ H5_GCC_DIAG_ON(float-equal)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
herr_t
|
||||
H5T__conv_ldouble_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, size_t buf_stride,
|
||||
@ -8347,7 +8340,6 @@ H5_GCC_DIAG_OFF(float-equal)
|
||||
H5T_CONV_Fx(LDOUBLE, USHORT, long double, unsigned short, 0, USHRT_MAX);
|
||||
H5_GCC_DIAG_ON(float-equal)
|
||||
}
|
||||
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -8473,7 +8465,6 @@ H5_GCC_DIAG_ON(float-equal)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
herr_t
|
||||
H5T__conv_ldouble_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, size_t buf_stride,
|
||||
@ -8484,7 +8475,6 @@ H5_GCC_DIAG_OFF(float-equal)
|
||||
H5T_CONV_Fx(LDOUBLE, INT, long double, int, INT_MIN, INT_MAX);
|
||||
H5_GCC_DIAG_ON(float-equal)
|
||||
}
|
||||
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -8639,7 +8629,6 @@ H5_GCC_DIAG_ON(float-equal)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
herr_t
|
||||
H5T__conv_ldouble_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, size_t buf_stride,
|
||||
@ -8650,7 +8639,6 @@ H5_GCC_DIAG_OFF(float-equal)
|
||||
H5T_CONV_Fx(LDOUBLE, LONG, long double, long, LONG_MIN, LONG_MAX);
|
||||
H5_GCC_DIAG_ON(float-equal)
|
||||
}
|
||||
#endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -8668,7 +8656,6 @@ H5_GCC_DIAG_ON(float-equal)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_INTEGER
|
||||
herr_t
|
||||
H5T__conv_ldouble_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, size_t buf_stride,
|
||||
@ -8679,7 +8666,6 @@ H5_GCC_DIAG_OFF(float-equal)
|
||||
H5T_CONV_Fx(LDOUBLE, ULONG, long double, unsigned long, 0, ULONG_MAX);
|
||||
H5_GCC_DIAG_ON(float-equal)
|
||||
}
|
||||
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
19
src/H5Tpkg.h
19
src/H5Tpkg.h
@ -177,18 +177,11 @@
|
||||
#define H5T_CONV_INTERNAL_ULLONG_LDOUBLE 1
|
||||
#endif
|
||||
|
||||
/* Define an internal macro for converting long double to all integers. SGI compilers give some incorrect
|
||||
* conversions. HP-UX 11.00 compiler generates floating exception. */
|
||||
#if (H5_WANT_DATA_ACCURACY && H5_LDOUBLE_TO_INTEGER_WORKS) || \
|
||||
(!H5_WANT_DATA_ACCURACY && H5_LDOUBLE_TO_INTEGER_WORKS)
|
||||
#define H5T_CONV_INTERNAL_LDOUBLE_INTEGER 1
|
||||
#endif
|
||||
|
||||
/* Define an internal macro for converting long double to unsigned int. SGI compilers give some incorrect
|
||||
* conversions. HP-UX 11.00 compiler generates floating exception. Some Intel compilers on some Linux
|
||||
* give incorrect values. */
|
||||
#if (H5_WANT_DATA_ACCURACY && H5_LDOUBLE_TO_UINT_ACCURATE && \
|
||||
H5_LDOUBLE_TO_INTEGER_WORKS) || (!H5_WANT_DATA_ACCURACY && H5_LDOUBLE_TO_INTEGER_WORKS)
|
||||
#if (H5_WANT_DATA_ACCURACY && H5_LDOUBLE_TO_UINT_ACCURATE) \
|
||||
|| (!H5_WANT_DATA_ACCURACY)
|
||||
#define H5T_CONV_INTERNAL_LDOUBLE_UINT 1
|
||||
#endif
|
||||
|
||||
@ -202,8 +195,8 @@
|
||||
* conversions. Mac OS 10.4 gives incorrect conversions. HP-UX 11.00 compiler generates floating exception.
|
||||
* The hard conversion on Windows .NET 2003 has a bug and gives wrong exception value. */
|
||||
#if (H5_WANT_DATA_ACCURACY && !defined(H5_HW_FP_TO_LLONG_NOT_WORKS) && \
|
||||
H5_LDOUBLE_TO_INTEGER_WORKS && defined(H5_LDOUBLE_TO_LLONG_ACCURATE)) || \
|
||||
(!H5_WANT_DATA_ACCURACY && !defined(H5_HW_FP_TO_LLONG_NOT_WORKS) && H5_LDOUBLE_TO_INTEGER_WORKS)
|
||||
defined(H5_LDOUBLE_TO_LLONG_ACCURATE)) || \
|
||||
(!H5_WANT_DATA_ACCURACY && !defined(H5_HW_FP_TO_LLONG_NOT_WORKS))
|
||||
#define H5T_CONV_INTERNAL_LDOUBLE_LLONG 1
|
||||
#endif
|
||||
|
||||
@ -220,9 +213,9 @@
|
||||
/* Define an internal macro for converting long double to unsigned long long. SGI compilers give some
|
||||
* incorrect conversions. Mac OS 10.4 gives incorrect conversions. HP-UX 11.00 compiler generates
|
||||
* floating exception. */
|
||||
#if (H5_WANT_DATA_ACCURACY && H5_LDOUBLE_TO_INTEGER_WORKS && \
|
||||
#if (H5_WANT_DATA_ACCURACY && \
|
||||
H5_FP_TO_ULLONG_ACCURATE && defined(H5_FP_TO_ULLONG_RIGHT_MAXIMUM) && defined(H5_LDOUBLE_TO_LLONG_ACCURATE)) || \
|
||||
(!H5_WANT_DATA_ACCURACY && H5_LDOUBLE_TO_INTEGER_WORKS)
|
||||
(!H5_WANT_DATA_ACCURACY)
|
||||
#define H5T_CONV_INTERNAL_LDOUBLE_ULLONG 1
|
||||
#else
|
||||
#define H5T_CONV_INTERNAL_LDOUBLE_ULLONG 0
|
||||
|
@ -5309,7 +5309,6 @@ run_fp_int_conv(const char *name)
|
||||
#endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/
|
||||
#endif
|
||||
|
||||
#if H5_LDOUBLE_TO_INTEGER_WORKS
|
||||
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
|
||||
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
|
||||
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR);
|
||||
@ -5391,21 +5390,6 @@ run_fp_int_conv(const char *name)
|
||||
#endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM && H5_LDOUBLE_TO_LLONG_ACCURATE*/
|
||||
#endif
|
||||
#endif
|
||||
#else /*H5_LDOUBLE_TO_INTEGER_WORKS*/
|
||||
{
|
||||
char str[256]; /*hello string */
|
||||
|
||||
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
|
||||
name, "long double", "all integers");
|
||||
printf("%-70s", str);
|
||||
SKIPPED();
|
||||
#if H5_SIZEOF_LONG_DOUBLE!=0
|
||||
HDputs(" Test skipped due to hardware conversion error.");
|
||||
#else
|
||||
HDputs(" Test skipped due to disabled long double.");
|
||||
#endif
|
||||
}
|
||||
#endif /*H5_LDOUBLE_TO_INTEGER_WORKS */
|
||||
#ifndef H5_VMS
|
||||
} /* end for */
|
||||
#endif /* H5_VMS */
|
||||
|
Loading…
Reference in New Issue
Block a user