diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2005-02-25 20:26:32 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2005-02-25 20:26:32 (GMT) |
commit | 82ae8ac4e0ec0929e432c99361e68f5f60cb5553 (patch) | |
tree | 8efddab33d3eed5be9d584e70f55f8dddacfb1f2 /src | |
parent | cffc51b94c8536e89cab61e68b6122a0e186524a (diff) | |
download | hdf5-82ae8ac4e0ec0929e432c99361e68f5f60cb5553.zip hdf5-82ae8ac4e0ec0929e432c99361e68f5f60cb5553.tar.gz hdf5-82ae8ac4e0ec0929e432c99361e68f5f60cb5553.tar.bz2 |
[svn-r10087] Purpose: New feature and test
Description: Somehow, the hardware conversions between "long double" and other native floating-point
types were left out.
Solution: Added the hardware conversion functions in H5Tconv.c and test cases in dtypes.c.
Platforms tested: h5committest and fuss.
Misc. update: updated MANIFEST to replace bin/reconfigure.sh with bin/reconfigure
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Tconv.c | 130 | ||||
-rw-r--r-- | src/H5Tpkg.h | 23 | ||||
-rw-r--r-- | src/H5Tpublic.h | 2 |
3 files changed, 149 insertions, 6 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 156287e..891d6f8 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -6984,6 +6984,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_float_ldouble + * + * Purpose: Convert native `float' to native `long double' using hardware. + * This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Friday, Feb 25, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_float_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_float_ldouble, FAIL); + + H5T_CONV_fF(FLOAT, LDOUBLE, float, long double, -, -); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_double_float * * Purpose: Convert native `double' to native `float' using hardware. @@ -7023,6 +7055,102 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_conv_double_ldouble + * + * Purpose: Convert native `double' to native `long double' using hardware. + * This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Friday, Feb 25, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_double_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_double_ldouble, FAIL); + + H5T_CONV_fF(DOUBLE, LDOUBLE, double, long double, -, -); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5T_conv_ldouble_float + * + * Purpose: Convert native `long double' to native `float' using hardware. + * This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Friday, Feb 25, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_ldouble_float (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_float, FAIL); + + H5T_CONV_Ff(LDOUBLE, FLOAT, long double, float, -FLT_MAX, FLT_MAX); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5T_conv_ldouble_double + * + * Purpose: Convert native `long double' to native `double' using hardware. + * This is a fast special case. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * Friday, Feb 25, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_ldouble_double (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_double, FAIL); + + H5T_CONV_Ff(LDOUBLE, DOUBLE, long double, double, -DBL_MAX, DBL_MAX); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5T_conv_schar_float * * Purpose: Convert native signed char to native float using hardware. @@ -7886,7 +8014,6 @@ done: } -#ifdef H5_ULLONG_TO_FP_CAST_WORKS /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_float * @@ -7981,7 +8108,6 @@ H5T_conv_ullong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, done: FUNC_LEAVE_NOAPI(ret_value); } -#endif /* H5_ULLONG_TO_FP_CAST_WORKS */ /*------------------------------------------------------------------------- diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index edac524..9d8900a 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -848,17 +848,36 @@ H5_DLL herr_t H5T_conv_ullong_llong(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_float_double(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_float_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_double_float(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_double_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_ldouble_float(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_double(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_schar_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, @@ -994,7 +1013,6 @@ H5_DLL herr_t H5T_conv_llong_ldouble(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); -#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, size_t buf_stride, size_t bkg_stride, @@ -1010,7 +1028,6 @@ H5_DLL herr_t H5T_conv_ullong_ldouble(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); -#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, size_t buf_stride, size_t bkg_stride, diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index 5d1af95..ddec8bb 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -202,7 +202,7 @@ typedef herr_t (*H5T_conv_t) (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, void *bkg, hid_t dset_xfer_plist); /* Exception handler. If an exception like overflow happenes during conversion, - * this function is called if it's registered through H5Tset_type_conv_cb. + * this function is called if it's registered through H5Pset_type_conv_cb. */ typedef H5T_conv_ret_t (*H5T_conv_except_func_t)(int except_type, hid_t src_id, hid_t dst_id, void *src_buf, void *dst_buf, void *user_data); |