diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2005-02-10 22:19:39 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2005-02-10 22:19:39 (GMT) |
commit | 479bdb0bbdb3ba2f75cf374ff6086e1f711c624d (patch) | |
tree | 5f040666d5e964651bfefcccd2ca40654cdf2cb0 | |
parent | 39e11427c5845a9520e63e760ca5cc9fe62d98d6 (diff) | |
download | hdf5-479bdb0bbdb3ba2f75cf374ff6086e1f711c624d.zip hdf5-479bdb0bbdb3ba2f75cf374ff6086e1f711c624d.tar.gz hdf5-479bdb0bbdb3ba2f75cf374ff6086e1f711c624d.tar.bz2 |
[svn-r9984] Purpose: New feature and test
Description: Added support of hardware conversion between "long double" and integers(mainly
in H5Tconv.c) and some test cases(mainly in test/dtypes.c).
Platforms tested: h5committest and fuss.
Misc. update: RELEASE.txt
-rw-r--r-- | src/H5T.c | 23 | ||||
-rw-r--r-- | src/H5Tconv.c | 687 | ||||
-rw-r--r-- | src/H5Tpkg.h | 103 | ||||
-rw-r--r-- | src/H5Tprecis.c | 6 | ||||
-rw-r--r-- | src/H5Tpublic.h | 2 | ||||
-rw-r--r-- | test/dtypes.c | 125 |
6 files changed, 863 insertions, 83 deletions
@@ -675,6 +675,7 @@ H5T_init_interface(void) H5T_t *native_ullong=NULL; /* Datatype structure for native unsigned llong */ H5T_t *native_float=NULL; /* Datatype structure for native float */ H5T_t *native_double=NULL; /* Datatype structure for native double */ + H5T_t *native_ldouble=NULL; /* Datatype structure for native double */ H5T_t *std_u8le=NULL; /* Datatype structure for unsigned 8-bit little-endian integer */ H5T_t *std_u8be=NULL; /* Datatype structure for unsigned 8-bit big-endian integer */ H5T_t *std_u16le=NULL; /* Datatype structure for unsigned 16-bit little-endian integer */ @@ -746,6 +747,8 @@ H5T_init_interface(void) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL==(native_double=H5I_object(H5T_NATIVE_DOUBLE_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); + if (NULL==(native_ldouble=H5I_object(H5T_NATIVE_LDOUBLE_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); /*------------------------------------------------------------ * Native types @@ -1096,84 +1099,104 @@ H5T_init_interface(void) /* From char to floats */ status |= H5T_register(H5T_PERS_HARD, "schar_flt", native_schar, native_float, H5T_conv_schar_float, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "schar_dbl", native_schar, native_double, H5T_conv_schar_double, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T_conv_schar_ldouble, H5AC_dxpl_id); /* From unsigned char to floats */ status |= H5T_register(H5T_PERS_HARD, "uchar_flt", native_uchar, native_float, H5T_conv_uchar_float, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "uchar_dbl", native_uchar, native_double, H5T_conv_uchar_double, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T_conv_uchar_ldouble, H5AC_dxpl_id); /* From short to floats */ status |= H5T_register(H5T_PERS_HARD, "short_flt", native_short, native_float, H5T_conv_short_float, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "short_dbl", native_short, native_double, H5T_conv_short_double, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T_conv_short_ldouble, H5AC_dxpl_id); /* From unsigned short to floats */ status |= H5T_register(H5T_PERS_HARD, "ushort_flt", native_ushort, native_float, H5T_conv_ushort_float, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "ushort_dbl", native_ushort, native_double, H5T_conv_ushort_double, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble, H5T_conv_ushort_ldouble, H5AC_dxpl_id); /* From int to floats */ status |= H5T_register(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T_conv_int_float, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "int_dbl", native_int, native_double, H5T_conv_int_double, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T_conv_int_ldouble, H5AC_dxpl_id); /* From unsigned int to floats */ status |= H5T_register(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T_conv_uint_float, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "uint_dbl", native_uint, native_double, H5T_conv_uint_double, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T_conv_uint_ldouble, H5AC_dxpl_id); /* From long to floats */ status |= H5T_register(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T_conv_long_float, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "long_dbl", native_long, native_double, H5T_conv_long_double, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T_conv_long_ldouble, H5AC_dxpl_id); /* From unsigned long to floats */ status |= H5T_register(H5T_PERS_HARD, "ulong_flt", native_ulong, native_float, H5T_conv_ulong_float, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T_conv_ulong_double, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T_conv_ulong_ldouble, H5AC_dxpl_id); /* From long long to floats */ status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T_conv_llong_float, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T_conv_llong_double, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T_conv_llong_ldouble, H5AC_dxpl_id); #ifdef H5_ULLONG_TO_FP_CAST_WORKS /* From unsigned long long to floats */ status |= H5T_register(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T_conv_ullong_float, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T_conv_ullong_double, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T_conv_ullong_ldouble, H5AC_dxpl_id); #endif /* H5_ULLONG_TO_FP_CAST_WORKS */ /* From floats to char */ status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T_conv_float_schar, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T_conv_double_schar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T_conv_ldouble_schar, H5AC_dxpl_id); /* From floats to unsigned char */ status |= H5T_register(H5T_PERS_HARD, "flt_uchar", native_float, native_uchar, H5T_conv_float_uchar, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T_conv_double_uchar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T_conv_ldouble_uchar, H5AC_dxpl_id); /* From floats to short */ status |= H5T_register(H5T_PERS_HARD, "flt_short", native_float, native_short, H5T_conv_float_short, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T_conv_double_short, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T_conv_ldouble_short, H5AC_dxpl_id); /* From floats to unsigned short */ status |= H5T_register(H5T_PERS_HARD, "flt_ushort", native_float, native_ushort, H5T_conv_float_ushort, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T_conv_double_ushort, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T_conv_ldouble_ushort, H5AC_dxpl_id); /* From floats to int */ status |= H5T_register(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T_conv_float_int, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T_conv_double_int, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T_conv_ldouble_int, H5AC_dxpl_id); /* From floats to unsigned int */ status |= H5T_register(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T_conv_float_uint, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T_conv_double_uint, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T_conv_ldouble_uint, H5AC_dxpl_id); /* From floats to long */ status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T_conv_float_long, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T_conv_double_long, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T_conv_ldouble_long, H5AC_dxpl_id); /* From floats to unsigned long */ status |= H5T_register(H5T_PERS_HARD, "flt_ulong", native_float, native_ulong, H5T_conv_float_ulong, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T_conv_double_ulong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T_conv_ldouble_ulong, H5AC_dxpl_id); /* From floats to long long */ status |= H5T_register(H5T_PERS_HARD, "flt_llong", native_float, native_llong, H5T_conv_float_llong, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "dbl_llong", native_double, native_llong, H5T_conv_double_llong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T_conv_ldouble_llong, H5AC_dxpl_id); /* From floats to unsigned long long */ status |= H5T_register(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T_conv_float_ullong, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T_conv_double_ullong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T_conv_ldouble_ullong, H5AC_dxpl_id); /* * The special no-op conversion is the fastest, so we list it last. The diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 1e66513..e8905c0 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -123,14 +123,22 @@ H5FL_BLK_DEFINE_STATIC(array_seq); * least as large as the destination. Overflows can occur when * the destination is narrower than the source. * - * xF: Integers to float-point values where the desination is + * xF: Integers to float-point(float or double) values where the desination + * is at least as wide as the source. This case cannot generate + * overflows. + * + * Fx: Float-point(float or double) values to integer where the source is + * at least as wide as the destination. Overflow can occur + * when the source magnitude is too large for the destination. + * + * xL: Integers to float-point(long double) values where the desination is * at least as wide as the source. This case cannot generate * overflows. * - * Fx: Float-point values to integer where the source is + * Lx: Float-point(long double) values to integer where the source is * at least as wide as the destination. Overflow can occur * when the source magnitude is too large for the destination. - * + * The macros take a subset of these arguments in the order listed here: * * CDATA: A pointer to the H5T_cdata_t structure that was passed to the @@ -459,6 +467,14 @@ H5FL_BLK_DEFINE_STATIC(array_seq); H5T_CONV(H5T_CONV_Xx, double, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ } +#define H5T_CONV_xL(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ + H5T_CONV(H5T_CONV_xX, long double, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ +} + +#define H5T_CONV_Lx(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ + H5T_CONV(H5T_CONV_Xx, long double, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ +} + /* The main part of every integer hardware conversion macro */ #define H5T_CONV(GUTS,ATYPE,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ size_t elmtno; /*element number */ \ @@ -7083,6 +7099,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_schar_ldouble + * + * Purpose: Convert native signed char to native long double using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_schar_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_schar_ldouble, FAIL); + + H5T_CONV_xL(SCHAR, LDOUBLE, signed char, long double, -, -); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_uchar_float * * Purpose: Convert native unsigned char to native float using hardware. @@ -7147,6 +7195,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_uchar_ldouble + * + * Purpose: Convert native unsigned char to native long double using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_uchar_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_uchar_ldouble, FAIL); + + H5T_CONV_xL(UCHAR, LDOUBLE, unsigned char, long double, -, -); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_short_float * * Purpose: Convert native short to native float using hardware. @@ -7211,6 +7291,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_short_ldouble + * + * Purpose: Convert native short to native long double using hardware. + * This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_short_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_short_ldouble, FAIL); + + H5T_CONV_xL(SHORT, LDOUBLE, short, long double, -, -); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_ushort_float * * Purpose: Convert native unsigned short to native float using hardware. @@ -7275,6 +7387,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_ushort_ldouble + * + * Purpose: Convert native unsigned short to native long double using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_ushort_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_ushort_ldouble, FAIL); + + H5T_CONV_xL(USHORT, LDOUBLE, unsigned short, long double, -, -); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_int_float * * Purpose: Convert native integer to native float using hardware. @@ -7339,6 +7483,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_int_ldouble + * + * Purpose: Convert native integer to native long double using hardware. + * This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_int_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_int_ldouble, FAIL); + + H5T_CONV_xL(INT, LDOUBLE, int, long double, -, -); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_uint_float * * Purpose: Convert native unsigned integer to native float using @@ -7403,6 +7579,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_uint_ldouble + * + * Purpose: Convert native unsigned integer to native long double using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_uint_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_uint_ldouble, FAIL); + + H5T_CONV_xL(UINT, LDOUBLE, unsigned int, long double, -, -); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_long_float * * Purpose: Convert native long to native float using hardware. @@ -7467,9 +7675,41 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_long_ldouble + * + * Purpose: Convert native long to native long double using hardware. + * This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_long_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_long_ldouble, FAIL); + + H5T_CONV_xL(LONG, LDOUBLE, long, long double, -, -); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_ulong_float * - * Purpose: Convert native native long to native float using hardware. + * Purpose: Convert native unsigned long to native float using hardware. * This is a fast special case. * * Return: Non-negative on success/Negative on failure @@ -7501,7 +7741,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ulong_double * - * Purpose: Convert native native long to native double using hardware. + * Purpose: Convert native unsigned long to native double using hardware. * This is a fast special case. * * Return: Non-negative on success/Negative on failure @@ -7529,6 +7769,37 @@ done: FUNC_LEAVE_NOAPI(ret_value); } + +/*------------------------------------------------------------------------- + * Function: H5T_conv_ulong_ldouble + * + * Purpose: Convert native unsigned long to native long double using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_ulong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_ulong_ldouble, FAIL); + + H5T_CONV_xL(ULONG, LDOUBLE, unsigned long, long double, -, -); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /*------------------------------------------------------------------------- @@ -7594,9 +7865,41 @@ done: FUNC_LEAVE_NOAPI(ret_value); } -#ifdef H5_ULLONG_TO_FP_CAST_WORKS /*------------------------------------------------------------------------- + * Function: H5T_conv_llong_ldouble + * + * Purpose: Convert native long long to native long double using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_llong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_llong_ldouble, FAIL); + + H5T_CONV_xL(LLONG, LDOUBLE, long_long, long double, -, -); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +#ifdef H5_ULLONG_TO_FP_CAST_WORKS +/*------------------------------------------------------------------------- * Function: H5T_conv_ullong_float * * Purpose: Convert native unsigned long long to native float using @@ -7658,6 +7961,38 @@ H5T_conv_ullong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, done: FUNC_LEAVE_NOAPI(ret_value); } + + +/*------------------------------------------------------------------------- + * Function: H5T_conv_ullong_ldouble + * + * Purpose: Convert native unsigned long long to native long double using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_ullong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_ullong_ldouble, FAIL); + + H5T_CONV_xL(ULLONG, LDOUBLE, unsigned long_long, long double, -, -); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} #endif /* H5_ULLONG_TO_FP_CAST_WORKS */ @@ -7728,7 +8063,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_double_schar * - * Purpose: Convert native float to native signed char using + * Purpose: Convert native double to native signed char using * hardware. This is a fast special case. * * Return: Non-negative on success/Negative on failure @@ -7760,7 +8095,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_double_uchar * - * Purpose: Convert native float to native unsigned char using + * Purpose: Convert native double to native unsigned char using * hardware. This is a fast special case. * * Return: Non-negative on success/Negative on failure @@ -7790,6 +8125,70 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_ldouble_schar + * + * Purpose: Convert native long double to native signed char using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +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, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_ldouble_schar, FAIL); + + H5T_CONV_Lx(LDOUBLE, SCHAR, long double, signed char, SCHAR_MIN, SCHAR_MAX); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5T_conv_ldouble_uchar + * + * Purpose: Convert native long double to native unsigned char using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +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, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_ldouble_uchar, FAIL); + + H5T_CONV_Lx(LDOUBLE, UCHAR, long double, unsigned char, 0, UCHAR_MAX); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_float_short * * Purpose: Convert native float to native short using @@ -7856,7 +8255,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_double_short * - * Purpose: Convert native float to native short using + * Purpose: Convert native double to native short using * hardware. This is a fast special case. * * Return: Non-negative on success/Negative on failure @@ -7888,7 +8287,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_double_ushort * - * Purpose: Convert native float to native unsigned short using + * Purpose: Convert native double to native unsigned short using * hardware. This is a fast special case. * * Return: Non-negative on success/Negative on failure @@ -7918,6 +8317,70 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_ldouble_short + * + * Purpose: Convert native long double to native short using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +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, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_ldouble_short, FAIL); + + H5T_CONV_Lx(LDOUBLE, SHORT, long double, short, SHRT_MIN, SHRT_MAX); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5T_conv_ldouble_ushort + * + * Purpose: Convert native long double to native unsigned short using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +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, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_ldouble_ushort, FAIL); + + H5T_CONV_Lx(LDOUBLE, USHORT, long double, unsigned short, 0, USHRT_MAX); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_float_int * * Purpose: Convert native float to native int using @@ -7984,7 +8447,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_double_int * - * Purpose: Convert native float to native int using + * Purpose: Convert native double to native int using * hardware. This is a fast special case. * * Return: Non-negative on success/Negative on failure @@ -8016,7 +8479,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_double_uint * - * Purpose: Convert native float to native unsigned int using + * Purpose: Convert native double to native unsigned int using * hardware. This is a fast special case. * * Return: Non-negative on success/Negative on failure @@ -8046,6 +8509,70 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_ldouble_int + * + * Purpose: Convert native long double to native int using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +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, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_ldouble_int, FAIL); + + H5T_CONV_Lx(LDOUBLE, INT, long double, int, INT_MIN, INT_MAX); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5T_conv_ldouble_uint + * + * Purpose: Convert native long double to native unsigned int using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_ldouble_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_ldouble_uint, FAIL); + + H5T_CONV_Lx(LDOUBLE, UINT, long double, unsigned int, 0, UINT_MAX); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_float_long * * Purpose: Convert native float to native long using @@ -8112,7 +8639,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_double_long * - * Purpose: Convert native float to native long using + * Purpose: Convert native double to native long using * hardware. This is a fast special case. * * Return: Non-negative on success/Negative on failure @@ -8144,7 +8671,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_double_ulong * - * Purpose: Convert native float to native unsigned long using + * Purpose: Convert native double to native unsigned long using * hardware. This is a fast special case. * * Return: Non-negative on success/Negative on failure @@ -8174,6 +8701,70 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_ldouble_long + * + * Purpose: Convert native long double to native long using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +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, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_ldouble_long, FAIL); + + H5T_CONV_Lx(LDOUBLE, LONG, long double, long, LONG_MIN, LONG_MAX); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5T_conv_ldouble_ulong + * + * Purpose: Convert native long double to native unsigned long using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +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, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_ldouble_ulong, FAIL); + + H5T_CONV_Lx(LDOUBLE, ULONG, long double, unsigned long, 0, ULONG_MAX); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_float_llong * * Purpose: Convert native float to native long long using @@ -8240,7 +8831,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_double_llong * - * Purpose: Convert native float to native long long using + * Purpose: Convert native double to native long long using * hardware. This is a fast special case. * * Return: Non-negative on success/Negative on failure @@ -8272,7 +8863,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_double_ullong * - * Purpose: Convert native float to native unsigned long long using + * Purpose: Convert native double to native unsigned long long using * hardware. This is a fast special case. * * Return: Non-negative on success/Negative on failure @@ -8302,6 +8893,70 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_ldouble_llong + * + * Purpose: Convert native long double to native long long using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_ldouble_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t UNUSED dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_ldouble_llong, FAIL); + + H5T_CONV_Lx(LDOUBLE, LLONG, long double, long_long, LLONG_MIN, LLONG_MAX); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5T_conv_ldouble_ullong + * + * Purpose: Convert native long double to native unsigned long long using + * hardware. This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Tuesday, Febuary 1, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_ldouble_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t dxpl_id) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5T_conv_ldouble_ullong, FAIL); + + H5T_CONV_Lx(LDOUBLE, ULLONG, long double, unsigned long_long, 0, ULLONG_MAX); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_i32le_f64le * * Purpose: Converts 4-byte little-endian integers (signed or unsigned) diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index c08f5db..edac524 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -320,6 +320,8 @@ H5_DLLVAR float H5T_NATIVE_FLOAT_POS_INF_g; H5_DLLVAR float H5T_NATIVE_FLOAT_NEG_INF_g; H5_DLLVAR double H5T_NATIVE_DOUBLE_POS_INF_g; H5_DLLVAR double H5T_NATIVE_DOUBLE_NEG_INF_g; +H5_DLLVAR double H5T_NATIVE_LDOUBLE_POS_INF_g; +H5_DLLVAR double H5T_NATIVE_LDOUBLE_NEG_INF_g; /* Common functions */ H5_DLL H5T_t *H5T_create(H5T_class_t type, size_t size); @@ -867,6 +869,11 @@ H5_DLL herr_t H5T_conv_schar_double(hid_t src_id, hid_t dst_id, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); +H5_DLL herr_t H5T_conv_schar_ldouble(hid_t src_id, hid_t dst_id, + H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); H5_DLL herr_t H5T_conv_uchar_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, @@ -877,6 +884,11 @@ H5_DLL herr_t H5T_conv_uchar_double(hid_t src_id, hid_t dst_id, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); +H5_DLL herr_t H5T_conv_uchar_ldouble(hid_t src_id, hid_t dst_id, + H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); H5_DLL herr_t H5T_conv_short_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, @@ -887,6 +899,11 @@ H5_DLL herr_t H5T_conv_short_double(hid_t src_id, hid_t dst_id, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); +H5_DLL herr_t H5T_conv_short_ldouble(hid_t src_id, hid_t dst_id, + H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); H5_DLL herr_t H5T_conv_ushort_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, @@ -897,6 +914,11 @@ H5_DLL herr_t H5T_conv_ushort_double(hid_t src_id, hid_t dst_id, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); +H5_DLL herr_t H5T_conv_ushort_ldouble(hid_t src_id, hid_t dst_id, + H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); H5_DLL herr_t H5T_conv_int_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, @@ -907,6 +929,11 @@ H5_DLL herr_t H5T_conv_int_double(hid_t src_id, hid_t dst_id, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); +H5_DLL herr_t H5T_conv_int_ldouble(hid_t src_id, hid_t dst_id, + H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); H5_DLL herr_t H5T_conv_uint_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, @@ -917,6 +944,11 @@ H5_DLL herr_t H5T_conv_uint_double(hid_t src_id, hid_t dst_id, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); +H5_DLL herr_t H5T_conv_uint_ldouble(hid_t src_id, hid_t dst_id, + H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); H5_DLL herr_t H5T_conv_long_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, @@ -927,6 +959,11 @@ H5_DLL herr_t H5T_conv_long_double(hid_t src_id, hid_t dst_id, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); +H5_DLL herr_t H5T_conv_long_ldouble(hid_t src_id, hid_t dst_id, + H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); H5_DLL herr_t H5T_conv_ulong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, @@ -937,6 +974,11 @@ H5_DLL herr_t H5T_conv_ulong_double(hid_t src_id, hid_t dst_id, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); +H5_DLL herr_t H5T_conv_ulong_ldouble(hid_t src_id, hid_t dst_id, + H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); H5_DLL herr_t H5T_conv_llong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, @@ -947,6 +989,11 @@ H5_DLL herr_t H5T_conv_llong_double(hid_t src_id, hid_t dst_id, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); +H5_DLL herr_t H5T_conv_llong_ldouble(hid_t src_id, hid_t dst_id, + H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); #ifdef H5_ULLONG_TO_FP_CAST_WORKS H5_DLL herr_t H5T_conv_ullong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, @@ -958,6 +1005,11 @@ H5_DLL herr_t H5T_conv_ullong_double(hid_t src_id, hid_t dst_id, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); +H5_DLL herr_t H5T_conv_ullong_ldouble(hid_t src_id, hid_t dst_id, + H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); #endif /* H5_ULLONG_TO_FP_CAST_WORKS */ H5_DLL herr_t H5T_conv_float_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, @@ -1059,6 +1111,57 @@ H5_DLL herr_t H5T_conv_double_ullong(hid_t src_id, hid_t dst_id, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); +H5_DLL 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, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); +H5_DLL 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, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); +H5_DLL 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, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); +H5_DLL 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, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); +H5_DLL 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, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); +H5_DLL herr_t H5T_conv_ldouble_uint(hid_t src_id, hid_t dst_id, + H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); +H5_DLL 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, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); +H5_DLL 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, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); +H5_DLL herr_t H5T_conv_ldouble_llong(hid_t src_id, hid_t dst_id, + H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); +H5_DLL herr_t H5T_conv_ldouble_ullong(hid_t src_id, hid_t dst_id, + H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t bkg_stride, + void *buf, void *bkg, + hid_t dset_xfer_plist); + H5_DLL herr_t H5T_conv_i32le_f64le(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c index f54de77..3e492c3 100644 --- a/src/H5Tprecis.c +++ b/src/H5Tprecis.c @@ -242,12 +242,6 @@ H5T_set_precision(const H5T_t *dt, size_t prec) * first when decreasing the precision of a floating point * type. */ - /*printf("\nsign: %d ", dt->shared->u.atomic.u.f.sign); - printf("epos: %d ", dt->shared->u.atomic.u.f.epos); - printf("esize: %d ", dt->shared->u.atomic.u.f.esize); - printf("mpos: %d ", dt->shared->u.atomic.u.f.mpos); - printf("msize: %d ", dt->shared->u.atomic.u.f.msize); - printf("prec: %d\n", prec); */ if (dt->shared->u.atomic.u.f.sign >= prec+offset || dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec+offset || dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec+offset) diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index 951d49b..5d1af95 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -373,7 +373,7 @@ H5_DLLVAR hid_t H5T_FORTRAN_S1_g; * name. If the type begins with `U' then it is the unsigned version of the * integer type; other integer types are signed. The type LLONG corresponds * to C's `long_long' and LDOUBLE is `long double' (these types might be the - * same as `LONG' and `DOUBLE' respectively. + * same as `LONG' and `DOUBLE' respectively). */ #define H5T_NATIVE_CHAR (CHAR_MIN?H5T_NATIVE_SCHAR:H5T_NATIVE_UCHAR) #define H5T_NATIVE_SCHAR (H5OPEN H5T_NATIVE_SCHAR_g) diff --git a/test/dtypes.c b/test/dtypes.c index c119eb7..f1a7ca0 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -6617,6 +6617,15 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst) /* Make certain that there isn't some weird number of destination bits */ assert(dst_nbits%8==0); + + /* For Intel machines, the size of "long double" is 12 byte, precision + * is 80 bits. During hardware conversion, the last 2 byte may have + * garbage in them. Clean them out with 0s before compare the values. + */ + if(endian==H5T_ORDER_LE && dst_type==FLT_LDOUBLE && dst_size==12) { + buf[j*dst_size+10] = 0x00; + buf[j*dst_size+11] = 0x00; + } /* Are the two results the same? */ for (k=(dst_size-(dst_nbits/8)); k<dst_size; k++) @@ -7290,33 +7299,32 @@ run_int_float_conv(const char *name) #endif /* H5_ULLONG_TO_FP_CAST_WORKS */ #endif - if(!strcmp(name, "sw")) { #if H5_SW_INTEGER_TO_LDOUBLE_WORKS #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - nerrors += test_conv_int_float(name, H5T_NATIVE_SCHAR, H5T_NATIVE_LDOUBLE); - nerrors += test_conv_int_float(name, H5T_NATIVE_UCHAR, H5T_NATIVE_LDOUBLE); - nerrors += test_conv_int_float(name, H5T_NATIVE_SHORT, H5T_NATIVE_LDOUBLE); - nerrors += test_conv_int_float(name, H5T_NATIVE_USHORT, H5T_NATIVE_LDOUBLE); - nerrors += test_conv_int_float(name, H5T_NATIVE_INT, H5T_NATIVE_LDOUBLE); - nerrors += test_conv_int_float(name, H5T_NATIVE_UINT, H5T_NATIVE_LDOUBLE); + nerrors += test_conv_int_float(name, H5T_NATIVE_SCHAR, H5T_NATIVE_LDOUBLE); + nerrors += test_conv_int_float(name, H5T_NATIVE_UCHAR, H5T_NATIVE_LDOUBLE); + nerrors += test_conv_int_float(name, H5T_NATIVE_SHORT, H5T_NATIVE_LDOUBLE); + nerrors += test_conv_int_float(name, H5T_NATIVE_USHORT, H5T_NATIVE_LDOUBLE); + nerrors += test_conv_int_float(name, H5T_NATIVE_INT, H5T_NATIVE_LDOUBLE); + nerrors += test_conv_int_float(name, H5T_NATIVE_UINT, H5T_NATIVE_LDOUBLE); #if H5_SIZEOF_LONG!=H5_SIZEOF_INT - nerrors += test_conv_int_float(name, H5T_NATIVE_LONG, H5T_NATIVE_LDOUBLE); - nerrors += test_conv_int_float(name, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE); + nerrors += test_conv_int_float(name, H5T_NATIVE_LONG, H5T_NATIVE_LDOUBLE); + nerrors += test_conv_int_float(name, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE); #endif #if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG - nerrors += test_conv_int_float(name, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE); + nerrors += test_conv_int_float(name, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE); #if H5_ULLONG_TO_FP_CAST_WORKS && H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS - nerrors += test_conv_int_float(name, H5T_NATIVE_ULLONG, H5T_NATIVE_LDOUBLE); + nerrors += test_conv_int_float(name, H5T_NATIVE_ULLONG, H5T_NATIVE_LDOUBLE); #else /* H5_ULLONG_TO_FP_CAST_WORKS && H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS */ - { - char str[256]; /*hello string */ - - sprintf(str, "Testing random %s %s -> %s conversions", - name, "unsigned long long", "long double"); - printf("%-70s", str); - SKIPPED(); - HDputs(" Test skipped due to compiler not handling conversion."); - } + { + char str[256]; /*hello string */ + + sprintf(str, "Testing random %s %s -> %s conversions", + name, "unsigned long long", "long double"); + printf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to compiler not handling conversion."); + } #endif /* H5_ULLONG_TO_FP_CAST_WORKS && H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS */ #endif #endif @@ -7331,7 +7339,6 @@ run_int_float_conv(const char *name) HDputs(" Test skipped due to hardware conversion error."); } #endif /*H5_SW_INTEGER_TO_LDOUBLE_WORKS*/ - } return nerrors; } @@ -7416,61 +7423,59 @@ run_float_int_conv(const char *name) #endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/ #endif - if(!strcmp(name, "sw")) { #if H5_SW_LDOUBLE_TO_INTEGER_WORKS #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); - nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); - nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); - nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); - nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); + nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); + nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); + nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); + nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); #if H5_CV_LDOUBLE_TO_UINT_WORKS - nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); + nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); #else /*H5_CV_LDOUBLE_TO_UINT_WORKS*/ - { - char str[256]; /*string */ - - sprintf(str, "Testing random %s %s -> %s conversions", - name, "long double", "unsigned int"); - printf("%-70s", str); - SKIPPED(); - HDputs(" Test skipped due to hardware conversion error."); - } + { + char str[256]; /*string */ + + sprintf(str, "Testing random %s %s -> %s conversions", + name, "long double", "unsigned int"); + printf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to hardware conversion error."); + } #endif /*H5_CV_LDOUBLE_TO_UINT_WORKS*/ #if H5_SIZEOF_LONG!=H5_SIZEOF_INT - nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG); - nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG); + nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG); + nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG); #endif #if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG - nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LLONG); + nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LLONG); #ifdef H5_FP_TO_ULLONG_RIGHT_MAXIMUM - nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULLONG); + nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULLONG); #else /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/ - { - char str[256]; /*string */ - - sprintf(str, "Testing random %s %s -> %s conversions", - name, "long double", "unsigned long long"); - printf("%-70s", str); - SKIPPED(); - HDputs(" Test skipped due to hardware conversion error."); - } + { + char str[256]; /*string */ + + sprintf(str, "Testing random %s %s -> %s conversions", + name, "long double", "unsigned long long"); + printf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to hardware conversion error."); + } #endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/ #endif #endif #else /*H5_SW_LDOUBLE_TO_INTEGER_WORKS*/ - { - char str[256]; /*hello string */ - - sprintf(str, "Testing random %s %s -> %s conversions", - name, "long double", "all integers"); - printf("%-70s", str); - SKIPPED(); - HDputs(" Test skipped due to hardware conversion error."); - } -#endif /*H5_SW_LDOUBLE_TO_INTEGER_WORKS*/ + { + char str[256]; /*hello string */ + + sprintf(str, "Testing random %s %s -> %s conversions", + name, "long double", "all integers"); + printf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to hardware conversion error."); } +#endif /*H5_SW_LDOUBLE_TO_INTEGER_WORKS*/ return nerrors; } |