summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2005-08-29 15:21:58 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2005-08-29 15:21:58 (GMT)
commitbd4312d0497592a665a25415ec2f9d3db9d9f6b2 (patch)
tree4c9e7590f44a1382ed651756835391245103efa6
parent636b5829a9c5c8908f4eefa71f7b653f4f1697ea (diff)
downloadhdf5-bd4312d0497592a665a25415ec2f9d3db9d9f6b2.zip
hdf5-bd4312d0497592a665a25415ec2f9d3db9d9f6b2.tar.gz
hdf5-bd4312d0497592a665a25415ec2f9d3db9d9f6b2.tar.bz2
[svn-r11311] Purpose: New features.
Description: Added 2 new configure options, --enable-exception and --enable-accuracy. --enable-exception lets the library check whether user's exception handling functions are present during compiler data conversions and use them if they are. When it's disabled, this step is skipped to improve conversion speed. This step isn't implemented yet for soft conversions because there would be little gain in speed. --enable-accuracy guarantees data accuracy during data conversions. It means the library will choose compiler conversions only if the accurate data is secured. Otherwise, the library will go for the library's own conversions. If this option is disabled, the library uses compiler conversions in favor of their speed as long as they work even if data can be incorrect. Platforms tested: h5committest and fuss. Some systems may fail after this checkin.
-rw-r--r--config/irix5.x6
-rw-r--r--config/irix6.x6
-rwxr-xr-xconfigure460
-rw-r--r--configure.in375
-rw-r--r--src/H5T.c104
-rw-r--r--src/H5Tconv.c202
-rw-r--r--src/H5Tpkg.h96
-rw-r--r--src/H5config.h.in48
-rw-r--r--test/dt_arith.c86
9 files changed, 839 insertions, 544 deletions
diff --git a/config/irix5.x b/config/irix5.x
index 51b0462..874e263 100644
--- a/config/irix5.x
+++ b/config/irix5.x
@@ -61,7 +61,7 @@ esac
# Hard set flag to indicate that the 'unsigned long long' to floating-point
# value conversion are broken by the compilers (as of 4/27/04 - QAK)
-hdf5_cv_sw_ulong_to_fp_bottom_bit_works=${hdf5_cv_sw_ulong_to_fp_bottom_bit_works='no'}
+hdf5_cv_ulong_to_fp_bottom_bit_accurate=${hdf5_cv_ulong_to_fp_bottom_bit_accurate='no'}
# Set flags to avoid conversion between 'long double' and integers because of
# SGI's compiler problems. For both IRIX64 6.5 and IRIX 6.5, the compilers
@@ -76,5 +76,5 @@ hdf5_cv_sw_ulong_to_fp_bottom_bit_works=${hdf5_cv_sw_ulong_to_fp_bottom_bit_work
# long or long long -> long double : correct value but incorrect bit pattern
# unsigned long or long long -> long double : correct value but incorrect bit pattern
# (1/5/05 - SLU)
-hdf5_cv_sw_ldouble_to_int_works=${hdf5_cv_sw_ldouble_to_int_works='no'}
-hdf5_cv_sw_integer_to_ldouble_works=${hdf5_cv_sw_integer_to_ldouble_works='no'}
+hdf5_cv_ldouble_to_integer_accurate=${hdf5_cv_ldouble_to_integer_accurate='no'}
+hdf5_cv_integer_to_ldouble_accurate=${hdf5_cv_integer_to_ldouble_accurate='no'}
diff --git a/config/irix6.x b/config/irix6.x
index 2bc87c0..3c9920d 100644
--- a/config/irix6.x
+++ b/config/irix6.x
@@ -155,7 +155,7 @@ fi
# Hard set flag to indicate that the 'unsigned long long' to floating-point
# value conversion are broken by the compilers (as of 4/27/04 - QAK)
-hdf5_cv_sw_ulong_to_fp_bottom_bit_works=${hdf5_cv_sw_ulong_to_fp_bottom_bit_works='no'}
+hdf5_cv_ulong_to_fp_bottom_bit_accurate=${hdf5_cv_ulong_to_fp_bottom_bit_accurate='no'}
# Set flags to avoid conversion between 'long double' and integers because of
# SGI's compiler problems. For both IRIX64 6.5 and IRIX 6.5, the compilers
@@ -170,8 +170,8 @@ hdf5_cv_sw_ulong_to_fp_bottom_bit_works=${hdf5_cv_sw_ulong_to_fp_bottom_bit_work
# long or long long -> long double : correct value but incorrect bit pattern
# unsigned long or long long -> long double : correct value but incorrect bit pattern
# (1/5/05 - SLU)
-hdf5_cv_sw_ldouble_to_integer_works=${hdf5_cv_sw_ldouble_to_integer_works='no'}
-hdf5_cv_sw_integer_to_ldouble_works=${hdf5_cv_sw_integer_to_ldouble_works='no'}
+hdf5_cv_ldouble_to_integer_accurate=${hdf5_cv_ldouble_to_integer_accurate='no'}
+hdf5_cv_integer_to_ldouble_accurate=${hdf5_cv_integer_to_ldouble_accurate='no'}
# For IRIX 6.5, any version that is older than MIPSpro 7.3.1.3m,
# the MPI derived datatype is not working.
diff --git a/configure b/configure
index e55c99a..b9a0094 100755
--- a/configure
+++ b/configure
@@ -1082,6 +1082,10 @@ Optional Features:
--enable-filters=all Turn on all internal I/O filters. One may also
specify a comma-separated list of filters or the
word no. The default is all internal I/O filters.
+ --enable-exception if exception handling functions is checked during
+ data conversions [default=yes]
+ --enable-accuracy if data accuracy is guaranteed during data
+ conversions [default=yes]
--enable-hl Enable the high level library [default=yes]
Optional Packages:
@@ -3512,7 +3516,7 @@ fi
# Provide some information about the compiler.
-echo "$as_me:3515:" \
+echo "$as_me:3519:" \
"checking for Fortran compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -3807,7 +3811,7 @@ _ACEOF
# flags.
ac_save_FFLAGS=$FCFLAGS
FCFLAGS="$FCFLAGS $ac_verb"
-(eval echo $as_me:3810: \"$ac_link\") >&5
+(eval echo $as_me:3814: \"$ac_link\") >&5
ac_fc_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
echo "$ac_fc_v_output" >&5
FCFLAGS=$ac_save_FFLAGS
@@ -3885,7 +3889,7 @@ _ACEOF
# flags.
ac_save_FFLAGS=$FCFLAGS
FCFLAGS="$FCFLAGS $ac_cv_prog_fc_v"
-(eval echo $as_me:3888: \"$ac_link\") >&5
+(eval echo $as_me:3892: \"$ac_link\") >&5
ac_fc_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
echo "$ac_fc_v_output" >&5
FCFLAGS=$ac_save_FFLAGS
@@ -6369,7 +6373,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6372 "configure"' > conftest.$ac_ext
+ echo '#line 6376 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7499,7 +7503,7 @@ fi
# Provide some information about the compiler.
-echo "$as_me:7502:" \
+echo "$as_me:7506:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -8568,11 +8572,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8571: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8575: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8575: \$? = $ac_status" >&5
+ echo "$as_me:8579: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -8823,11 +8827,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8826: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8830: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8830: \$? = $ac_status" >&5
+ echo "$as_me:8834: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -8883,11 +8887,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8886: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8890: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8890: \$? = $ac_status" >&5
+ echo "$as_me:8894: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -11155,7 +11159,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 11158 "configure"
+#line 11162 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11253,7 +11257,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 11256 "configure"
+#line 11260 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13489,11 +13493,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13492: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13496: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13496: \$? = $ac_status" >&5
+ echo "$as_me:13500: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -13549,11 +13553,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13552: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13556: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13556: \$? = $ac_status" >&5
+ echo "$as_me:13560: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -14968,7 +14972,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 14971 "configure"
+#line 14975 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15066,7 +15070,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 15069 "configure"
+#line 15073 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15921,11 +15925,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15924: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15928: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15928: \$? = $ac_status" >&5
+ echo "$as_me:15932: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -15981,11 +15985,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15984: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15988: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:15988: \$? = $ac_status" >&5
+ echo "$as_me:15992: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -18037,11 +18041,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18040: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18044: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:18044: \$? = $ac_status" >&5
+ echo "$as_me:18048: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -18292,11 +18296,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18295: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18299: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:18299: \$? = $ac_status" >&5
+ echo "$as_me:18303: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -18352,11 +18356,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18355: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18359: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:18359: \$? = $ac_status" >&5
+ echo "$as_me:18363: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -20624,7 +20628,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 20627 "configure"
+#line 20631 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20722,7 +20726,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 20725 "configure"
+#line 20729 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -49997,6 +50001,52 @@ _ACEOF
fi
+echo "$as_me:$LINENO: checking whether exception handling functions is checked during data conversions" >&5
+echo $ECHO_N "checking whether exception handling functions is checked during data conversions... $ECHO_C" >&6
+# Check whether --enable-exception or --disable-exception was given.
+if test "${enable_exception+set}" = set; then
+ enableval="$enable_exception"
+ DCONV_EXCEPTION=$enableval
+else
+ DCONV_EXCEPTION=yes
+fi;
+
+if test "$DCONV_EXCEPTION" = "yes"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define WANT_DCONV_EXCEPTION 1
+_ACEOF
+
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+echo "$as_me:$LINENO: checking whether data accuracy is guaranteed during data conversions" >&5
+echo $ECHO_N "checking whether data accuracy is guaranteed during data conversions... $ECHO_C" >&6
+# Check whether --enable-accuracy or --disable-accuracy was given.
+if test "${enable_accuracy+set}" = set; then
+ enableval="$enable_accuracy"
+ DATA_ACCURACY=$enableval
+else
+ DATA_ACCURACY=yes
+fi;
+
+if test "$DATA_ACCURACY" = "yes"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define WANT_DATA_ACCURACY 1
+_ACEOF
+
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
echo "$as_me:$LINENO: checking if converting denormalized floating-point values is possible" >&5
echo $ECHO_N "checking if converting denormalized floating-point values is possible... $ECHO_C" >&6
if test "${hdf5_cv_convert_denormal_float+set}" = set; then
@@ -50019,15 +50069,41 @@ else
echo "${ECHO_T}no" >&6
fi
+echo "$as_me:$LINENO: checking if converting from long double to integers is accurate" >&5
+echo $ECHO_N "checking if converting from long double to integers is accurate... $ECHO_C" >&6
+
+if test ${ac_cv_sizeof_long_double} = 0; then
+ hdf5_ldouble_to_integer_accurate=${hdf5_ldouble_to_integer_accurate=no}
+else
+ if test "${hdf5_cv_ldouble_to_integer_accurate+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ hdf5_cv_ldouble_to_integer_accurate=yes
+fi
+
+fi
+
+if test ${hdf5_cv_ldouble_to_integer_accurate} = "yes"; then
-echo "$as_me:$LINENO: checking if accurately converting from long double to integers works" >&5
-echo $ECHO_N "checking if accurately converting from long double to integers works... $ECHO_C" >&6
+cat >>confdefs.h <<\_ACEOF
+#define LDOUBLE_TO_INTEGER_ACCURATE 1
+_ACEOF
-if test ${ac_cv_sizeof_long_double}=0; then
- hdf5_cv_sw_ldouble_to_integer_works=${hdf5_cv_sw_ldouble_to_integer_works=no}
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-if test "${hdf5_cv_sw_ldouble_to_integer_works+set}" = set; then
+
+echo "$as_me:$LINENO: checking if converting from long double to integers works" >&5
+echo $ECHO_N "checking if converting from long double to integers works... $ECHO_C" >&6
+
+if test ${ac_cv_sizeof_long_double} = 0; then
+ hdf5_ldouble_to_integer_works=${hdf5_ldouble_to_integer_works=no}
+else
+ if test "${hdf5_ldouble_to_integer_works+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
@@ -50044,27 +50120,27 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.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);
- }
+ 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);
+ }
_ACEOF
rm -f conftest$ac_exeext
@@ -50078,24 +50154,25 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- hdf5_cv_sw_ldouble_to_integer_works=yes
+ hdf5_ldouble_to_integer_works=yes
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
-hdf5_cv_sw_ldouble_to_integer_works=no
+hdf5_ldouble_to_integer_works=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
+fi
-if test ${hdf5_cv_sw_ldouble_to_integer_works} = "yes"; then
+if test ${hdf5_ldouble_to_integer_works} = "yes"; then
cat >>confdefs.h <<\_ACEOF
-#define SW_LDOUBLE_TO_INTEGER_WORKS 1
+#define LDOUBLE_TO_INTEGER_WORKS 1
_ACEOF
echo "$as_me:$LINENO: result: yes" >&5
@@ -50105,25 +50182,24 @@ else
echo "${ECHO_T}no" >&6
fi
-echo "$as_me:$LINENO: checking if accurately converting from integers to long double works" >&5
-echo $ECHO_N "checking if accurately converting from integers to long double works... $ECHO_C" >&6
-
-if test ${ac_cv_sizeof_long_double}=0; then
- hdf5_cv_sw_integer_to_ldouble_works=${hdf5_cv_sw_integer_to_ldouble_works=no}
-fi
-
+echo "$as_me:$LINENO: checking if accurately converting from integers to long double" >&5
+echo $ECHO_N "checking if accurately converting from integers to long double... $ECHO_C" >&6
-if test "${hdf5_cv_sw_integer_to_ldouble_works+set}" = set; then
+if test ${ac_cv_sizeof_long_double} = 0; then
+ hdf5_cv_integer_to_ldouble_accurate=${hdf5_cv_integer_to_ldouble_accurate=no}
+else
+ if test "${hdf5_cv_integer_to_ldouble_accurate+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- hdf5_cv_sw_integer_to_ldouble_works=yes
+ hdf5_cv_integer_to_ldouble_accurate=yes
fi
+fi
-if test ${hdf5_cv_sw_integer_to_ldouble_works} = "yes"; then
+if test ${hdf5_cv_integer_to_ldouble_accurate} = "yes"; then
cat >>confdefs.h <<\_ACEOF
-#define SW_INTEGER_TO_LDOUBLE_WORKS 1
+#define INTEGER_TO_LDOUBLE_ACCURATE 1
_ACEOF
echo "$as_me:$LINENO: result: yes" >&5
@@ -50133,11 +50209,11 @@ else
echo "${ECHO_T}no" >&6
fi
-echo "$as_me:$LINENO: checking if accurately converting unsigned long long to floating-point values works" >&5
-echo $ECHO_N "checking if accurately converting unsigned long long to floating-point values works... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking if accurately converting unsigned long long to floating-point values" >&5
+echo $ECHO_N "checking if accurately converting unsigned long long to floating-point values... $ECHO_C" >&6
if test ${host_os_novers} = "solaris2.x"; then
- if test "${hdf5_cv_sw_ulong_to_fp_bottom_bit_works+set}" = set; then
+ if test "${hdf5_cv_ulong_to_fp_bottom_bit_accurate+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
@@ -50225,32 +50301,32 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- hdf5_cv_sw_ulong_to_fp_bottom_bit_works=yes
+ hdf5_cv_ulong_to_fp_bottom_bit_accurate=yes
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
-hdf5_cv_sw_ulong_to_fp_bottom_bit_works=no
+hdf5_cv_ulong_to_fp_bottom_bit_accurate=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
else
- if test "${hdf5_cv_sw_ulong_to_fp_bottom_bit_works+set}" = set; then
+ if test "${hdf5_cv_ulong_to_fp_bottom_bit_accurate+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- hdf5_cv_sw_ulong_to_fp_bottom_bit_works=yes
+ hdf5_cv_ulong_to_fp_bottom_bit_accurate=yes
fi
fi
-if test ${hdf5_cv_sw_ulong_to_fp_bottom_bit_works} = "yes"; then
+if test ${hdf5_cv_ulong_to_fp_bottom_bit_accurate} = "yes"; then
cat >>confdefs.h <<\_ACEOF
-#define SW_ULONG_TO_FP_BOTTOM_BIT_WORKS 1
+#define ULONG_TO_FP_BOTTOM_BIT_ACCURATE 1
_ACEOF
echo "$as_me:$LINENO: result: yes" >&5
@@ -50263,7 +50339,7 @@ fi
echo "$as_me:$LINENO: checking if accurately roundup converting floating-point to unsigned long long values" >&5
echo $ECHO_N "checking if accurately roundup converting floating-point to unsigned long long values... $ECHO_C" >&6
-if test "${hdf5_cv_fp_to_ullong_bottom_bit_works+set}" = set; then
+if test "${hdf5_fp_to_ullong_accurate+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
@@ -50309,24 +50385,24 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- hdf5_cv_fp_to_ullong_bottom_bit_works=yes
+ hdf5_fp_to_ullong_accurate=yes
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
-hdf5_cv_fp_to_ullong_bottom_bit_works=no
+hdf5_fp_to_ullong_accurate=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
-if test ${hdf5_cv_fp_to_ullong_bottom_bit_works} = "yes"; then
+if test ${hdf5_fp_to_ullong_accurate} = "yes"; then
cat >>confdefs.h <<\_ACEOF
-#define FP_TO_ULLONG_BOTTOM_BIT_WORKS 1
+#define FP_TO_ULLONG_ACCURATE 1
_ACEOF
echo "$as_me:$LINENO: result: yes" >&5
@@ -50339,7 +50415,7 @@ fi
echo "$as_me:$LINENO: checking if right maximum converting floating-point to unsigned long long values" >&5
echo $ECHO_N "checking if right maximum converting floating-point to unsigned long long values... $ECHO_C" >&6
-if test "${hdf5_cv_fp_to_ullong_right_maximum+set}" = set; then
+if test "${hdf5_fp_to_ullong_right_maximum+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
@@ -50392,21 +50468,21 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- hdf5_cv_fp_to_ullong_right_maximum=yes
+ hdf5_fp_to_ullong_right_maximum=yes
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
-hdf5_cv_fp_to_ullong_right_maximum=no
+hdf5_fp_to_ullong_right_maximum=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
-if test ${hdf5_cv_fp_to_ullong_right_maximum} = "yes"; then
+if test ${hdf5_fp_to_ullong_right_maximum} = "yes"; then
cat >>confdefs.h <<\_ACEOF
#define FP_TO_ULLONG_RIGHT_MAXIMUM 1
@@ -50419,14 +50495,13 @@ else
echo "${ECHO_T}no" >&6
fi
-echo "$as_me:$LINENO: checking if converting long double to unsigned int values works" >&5
-echo $ECHO_N "checking if converting long double to unsigned int values works... $ECHO_C" >&6
-
-if test ${ac_cv_sizeof_long_double}=0; then
- hdf5_cv_ldouble_to_uint_works=${hdf5_cv_ldouble_to_uint_works=no}
-fi
+echo "$as_me:$LINENO: checking if correctly converting long double to unsigned int values" >&5
+echo $ECHO_N "checking if correctly converting long double to unsigned int values... $ECHO_C" >&6
-if test "${hdf5_cv_ldouble_to_uint_works+set}" = set; then
+if test ${ac_cv_sizeof_long_double} = 0; then
+ hdf5_ldouble_to_uint_accurate=${hdf5_ldouble_to_uint_accurate=no}
+else
+ if test "${hdf5_ldouble_to_uint_accurate+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
@@ -50443,19 +50518,19 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
- int main(void)
- {
- long double ld = 2733248032.9183987530L;
- unsigned int i;
- int ret = 0;
+ int main(void)
+ {
+ long double ld = 2733248032.9183987530L;
+ unsigned int i;
+ int ret = 0;
- i = (unsigned int)ld;
- if(i!=2733248032 && i!=2733248031 && i!=2733248033)
- ret = 1;
+ i = (unsigned int)ld;
+ if(i!=2733248032 && i!=2733248031 && i!=2733248033)
+ ret = 1;
-done:
- exit(ret);
- }
+ done:
+ exit(ret);
+ }
_ACEOF
rm -f conftest$ac_exeext
@@ -50469,24 +50544,25 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- hdf5_cv_ldouble_to_uint_works=yes
+ hdf5_ldouble_to_uint_accurate=yes
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
-hdf5_cv_ldouble_to_uint_works=no
+hdf5_ldouble_to_uint_accurate=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
+fi
-if test ${hdf5_cv_ldouble_to_uint_works} = "yes"; then
+if test ${hdf5_ldouble_to_uint_accurate} = "yes"; then
cat >>confdefs.h <<\_ACEOF
-#define CV_LDOUBLE_TO_UINT_WORKS 1
+#define LDOUBLE_TO_UINT_ACCURATE 1
_ACEOF
echo "$as_me:$LINENO: result: yes" >&5
@@ -50540,14 +50616,13 @@ else
echo "${ECHO_T}no" >&6
fi
-echo "$as_me:$LINENO: checking if converting unsigned long long to long double with precision work" >&5
-echo $ECHO_N "checking if converting unsigned long long to long double with precision work... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking if converting unsigned long long to long double with precision" >&5
+echo $ECHO_N "checking if converting unsigned long long to long double with precision... $ECHO_C" >&6
-if test ${ac_cv_sizeof_long_double}=0; then
- hdf5_cv_ullong_to_ldouble_precision_works=${hdf5_cv_ullong_to_ldouble_precision_works=no}
-fi
-
-if test "${hdf5_cv_ullong_to_ldouble_precision_works+set}" = set; then
+if test ${ac_cv_sizeof_long_double} = 0; then
+ hdf5_cv_ullong_to_ldouble_precision=${hdf5_cv_ullong_to_ldouble_precision=no}
+else
+ if test "${hdf5_cv_ullong_to_ldouble_precision+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
@@ -50564,77 +50639,77 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
- int main(void)
- {
- /* General variables */
- int endian;
- int tst_value = 1;
- int ret = 0;
-
- /* For FreeBSD */
- unsigned long long l = 0xa601e80bda85fcefULL;
- long double ld;
- unsigned char *c1, *c2;
- size_t size;
-
- /* For Cygwin */
- unsigned long long l_cyg = 0xfffffffffffffff0ULL;
- long double ld_cyg;
- unsigned char *c2_cyg;
- size_t size_cyg;
-
-
- /* Determine this system's endianess */
- c1 = (unsigned char*)calloc(1, sizeof(int));
- memcpy((void*)c1, &tst_value, sizeof(int));
- if(c1[0]==1)
- endian = 0; /* little endian */
- else
- endian = 1; /* big endian */
-
- /* For FreeBSD */
- size = sizeof(long double);
- memset(&ld, 0, size);
- ld = (long double)l;
-
- c2 = (unsigned char*)calloc(1, size);
- memcpy((void*)c2, &ld, size);
-
- /* Test if the last 2 bytes of mantissa are lost. Mainly for FreeBSD on Intel
- * architecture(sleipnir) where it happens. */
- /*if(endian==0 && c2[0]==0 && c2[1]==0)*/ /*little endian*/
- if(endian==0 && c2[0]==0) { /*little endian*/
- ret = 1;
- goto done;
+ int main(void)
+ {
+ /* General variables */
+ int endian;
+ int tst_value = 1;
+ int ret = 0;
+
+ /* For FreeBSD */
+ unsigned long long l = 0xa601e80bda85fcefULL;
+ long double ld;
+ unsigned char *c1, *c2;
+ size_t size;
+
+ /* For Cygwin */
+ unsigned long long l_cyg = 0xfffffffffffffff0ULL;
+ long double ld_cyg;
+ unsigned char *c2_cyg;
+ size_t size_cyg;
+
+
+ /* Determine this system's endianess */
+ c1 = (unsigned char*)calloc(1, sizeof(int));
+ memcpy((void*)c1, &tst_value, sizeof(int));
+ if(c1[0]==1)
+ endian = 0; /* little endian */
+ else
+ endian = 1; /* big endian */
+
+ /* For FreeBSD */
+ size = sizeof(long double);
+ memset(&ld, 0, size);
+ ld = (long double)l;
+
+ c2 = (unsigned char*)calloc(1, size);
+ memcpy((void*)c2, &ld, size);
+
+ /* Test if the last 2 bytes of mantissa are lost. Mainly for FreeBSD on Intel
+ * architecture(sleipnir) where it happens. */
+ /*if(endian==0 && c2[0]==0 && c2[1]==0)*/ /*little endian*/
+ if(endian==0 && c2[0]==0) { /*little endian*/
+ ret = 1;
+ goto done;
+ }
+
+ /* For Cygwin */
+ size_cyg = sizeof(long double);
+ memset(&ld_cyg, 0, size);
+ ld_cyg = (long double)l_cyg;
+
+ c2_cyg = (unsigned char*)calloc(1, size_cyg);
+ memcpy((void*)c2_cyg, &ld_cyg, size_cyg);
+
+ /* Test if the last 4 bytes(roughly) of mantissa are rounded up. Mainly for Cygwin
+ * where the values like 0xffffffffffffffff, 0xfffffffffffffffe, ...,
+ * 0xfffffffffffff000 ... are rounded up as 0x0000403f8000000000000000
+ * instead of 0x0000403effffffffffffffff, 0x0000403efffffffffffffffe, ...,
+ * 0x0000403efffffffffffff000 ...
+ */
+ if(endian==0 && c2_cyg[0]==0 && c2_cyg[1]==0 && c2_cyg[2]==0 && c2_cyg[3]==0)
+ ret = 1;
+
+ done:
+ if(c1)
+ free(c1);
+ if(c2)
+ free(c2);
+ if(c2_cyg)
+ free(c2_cyg);
+ exit(ret);
}
- /* For Cygwin */
- size_cyg = sizeof(long double);
- memset(&ld_cyg, 0, size);
- ld_cyg = (long double)l_cyg;
-
- c2_cyg = (unsigned char*)calloc(1, size_cyg);
- memcpy((void*)c2_cyg, &ld_cyg, size_cyg);
-
- /* Test if the last 4 bytes(roughly) of mantissa are rounded up. Mainly for Cygwin
- * where the values like 0xffffffffffffffff, 0xfffffffffffffffe, ...,
- * 0xfffffffffffff000 ... are rounded up as 0x0000403f8000000000000000
- * instead of 0x0000403effffffffffffffff, 0x0000403efffffffffffffffe, ...,
- * 0x0000403efffffffffffff000 ...
- */
- if(endian==0 && c2_cyg[0]==0 && c2_cyg[1]==0 && c2_cyg[2]==0 && c2_cyg[3]==0)
- ret = 1;
-
-done:
- if(c1)
- free(c1);
- if(c2)
- free(c2);
- if(c2_cyg)
- free(c2_cyg);
- exit(ret);
- }
-
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
@@ -50647,24 +50722,25 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- hdf5_cv_ullong_to_ldouble_precision_works=yes
+ hdf5_cv_ullong_to_ldouble_precision=yes
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
-hdf5_cv_ullong_to_ldouble_precision_works=no
+hdf5_cv_ullong_to_ldouble_precision=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
+fi
-if test ${hdf5_cv_ullong_to_ldouble_precision_works} = "yes"; then
+if test ${hdf5_cv_ullong_to_ldouble_precision} = "yes"; then
cat >>confdefs.h <<\_ACEOF
-#define ULLONG_TO_LDOUBLE_PRECISION_WORKS 1
+#define ULLONG_TO_LDOUBLE_PRECISION 1
_ACEOF
echo "$as_me:$LINENO: result: yes" >&5
diff --git a/configure.in b/configure.in
index aa2b594..cb5aedf 100644
--- a/configure.in
+++ b/configure.in
@@ -2357,6 +2357,48 @@ if test 1 = 2; then
fi
dnl ----------------------------------------------------------------------
+dnl Decide whether the presence of user's exception handling functions is
+dnl checked and data conversion exceptions are returned. This is mainly
+dnl for the speed optimization of hard conversions. Soft conversions can
+dnl actually benefit little.
+dnl
+AC_MSG_CHECKING([whether exception handling functions is checked during data conversions])
+AC_ARG_ENABLE([exception],
+ [AC_HELP_STRING([--enable-exception],
+ [if exception handling functions is checked during
+ data conversions [default=yes]])],
+ [DCONV_EXCEPTION=$enableval], [DCONV_EXCEPTION=yes])
+
+if test "$DCONV_EXCEPTION" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([WANT_DCONV_EXCEPTION], [1],
+ [Check exception handling functions during data conversions])
+else
+ AC_MSG_RESULT([no])
+fi
+
+dnl ----------------------------------------------------------------------
+dnl Decide whether the data accuracy has higher priority during data
+dnl conversions. If not, some hard conversions will still be prefered even
+dnl though the data may be wrong (for example, some compilers don't
+dnl support denormalized floating values) to maximize speed.
+dnl
+AC_MSG_CHECKING([whether data accuracy is guaranteed during data conversions])
+AC_ARG_ENABLE([accuracy],
+ [AC_HELP_STRING([--enable-accuracy],
+ [if data accuracy is guaranteed during
+ data conversions [default=yes]])],
+ [DATA_ACCURACY=$enableval], [DATA_ACCURACY=yes])
+
+if test "$DATA_ACCURACY" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([WANT_DATA_ACCURACY], [1],
+ [Data accuracy is prefered to speed during data conversions])
+else
+ AC_MSG_RESULT([no])
+fi
+
+dnl ----------------------------------------------------------------------
dnl Set the flag to indicate that the machine can handle converting
dnl denormalized floating-point values.
dnl (This flag should be set for all machines, except for the Crays, where
@@ -2375,47 +2417,69 @@ fi
dnl -----------------------------------------------------------------------
dnl Set flag to indicate that the machine can handle conversion from
-dnl long double to integers. This flag should be set "yes" for all
-dnl machines except all SGIs and HP-UX 11.00. For SGIs, some conversions are
+dnl long double to integers accurately. This flag should be set "yes" for
+dnl all machines except all SGIs. For SGIs, some conversions are
dnl incorrect and its cache value is set "no" in its config/irix6.x and
-dnl irix5.x. For HP-UX 11.00, the compiler has 'floating exception'
-dnl when converting 'long double' to all integers except 'unsigned long long'.
-dnl Other HP-UX systems are unknown yet. (1/8/05 - SLU)
+dnl irix5.x.
+dnl
+AC_MSG_CHECKING([if converting from long double to integers is accurate])
-AC_MSG_CHECKING([if accurately converting from long double to integers works])
+if test ${ac_cv_sizeof_long_double} = 0; then
+ hdf5_ldouble_to_integer_accurate=${hdf5_ldouble_to_integer_accurate=no}
+else
+ AC_CACHE_VAL([hdf5_cv_ldouble_to_integer_accurate], [hdf5_cv_ldouble_to_integer_accurate=yes])
+fi
-if test ${ac_cv_sizeof_long_double}=0; then
- hdf5_cv_sw_ldouble_to_integer_works=${hdf5_cv_sw_ldouble_to_integer_works=no}
+if test ${hdf5_cv_ldouble_to_integer_accurate} = "yes"; then
+ AC_DEFINE([LDOUBLE_TO_INTEGER_ACCURATE], [1],
+ [Define if your system can convert long double to integers accurately.])
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
fi
-AC_CACHE_VAL([hdf5_cv_sw_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));
+dnl -----------------------------------------------------------------------
+dnl Set flag to indicate that the machine can do conversion from
+dnl long double to integers regardless of accuracy. This flag should be
+dnl set "yes" for all machines except HP-UX 11.00. For HP-UX 11.00, the
+dnl compiler has 'floating exception' when converting 'long double' to all
+dnl integers except 'unsigned long long'. Other HP-UX systems are unknown
+dnl yet. (1/8/05 - SLU)
-done:
- exit(ret);
- }
- ], [hdf5_cv_sw_ldouble_to_integer_works=yes], [hdf5_cv_sw_ldouble_to_integer_works=no],)])
+AC_MSG_CHECKING([if converting from long double to integers works])
-if test ${hdf5_cv_sw_ldouble_to_integer_works} = "yes"; then
- AC_DEFINE([SW_LDOUBLE_TO_INTEGER_WORKS], [1],
- [Define if your system can accurately convert from long double to integer values.])
+if test ${ac_cv_sizeof_long_double} = 0; then
+ hdf5_ldouble_to_integer_works=${hdf5_ldouble_to_integer_works=no}
+else
+ AC_CACHE_VAL([hdf5_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_ldouble_to_integer_works=yes], [hdf5_ldouble_to_integer_works=no],)])
+fi
+
+if test ${hdf5_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])
@@ -2428,17 +2492,16 @@ dnl machines except all SGIs, where some conversions are
dnl incorrect and its cache value is set "no" in its config/irix6.x and
dnl irix5.x)
dnl
-AC_MSG_CHECKING([if accurately converting from integers to long double works])
+AC_MSG_CHECKING([if accurately converting from integers to long double])
-if test ${ac_cv_sizeof_long_double}=0; then
- hdf5_cv_sw_integer_to_ldouble_works=${hdf5_cv_sw_integer_to_ldouble_works=no}
+if test ${ac_cv_sizeof_long_double} = 0; then
+ hdf5_cv_integer_to_ldouble_accurate=${hdf5_cv_integer_to_ldouble_accurate=no}
+else
+ AC_CACHE_VAL([hdf5_cv_integer_to_ldouble_accurate], [hdf5_cv_integer_to_ldouble_accurate=yes])
fi
-
-AC_CACHE_VAL([hdf5_cv_sw_integer_to_ldouble_works], [hdf5_cv_sw_integer_to_ldouble_works=yes])
-
-if test ${hdf5_cv_sw_integer_to_ldouble_works} = "yes"; then
- AC_DEFINE([SW_INTEGER_TO_LDOUBLE_WORKS], [1],
+if test ${hdf5_cv_integer_to_ldouble_accurate} = "yes"; then
+ AC_DEFINE([INTEGER_TO_LDOUBLE_ACCURATE], [1],
[Define if your system can accurately convert from integers to long double values.])
AC_MSG_RESULT([yes])
else
@@ -2453,10 +2516,10 @@ dnl the cache value is set in the config/irix6.x config file) and Solaris
dnl 64-bit machines, where the short program below tests if round-up is
dnl correctly handled.
dnl
-AC_MSG_CHECKING([if accurately converting unsigned long long to floating-point values works])
+AC_MSG_CHECKING([if accurately converting unsigned long long to floating-point values])
if test ${host_os_novers} = "solaris2.x"; then
- AC_CACHE_VAL([hdf5_cv_sw_ulong_to_fp_bottom_bit_works],
+ AC_CACHE_VAL([hdf5_cv_ulong_to_fp_bottom_bit_accurate],
[AC_TRY_RUN([
int main(void)
{
@@ -2516,13 +2579,13 @@ if test ${host_os_novers} = "solaris2.x"; then
done:
exit(ret);
}
- ], [hdf5_cv_sw_ulong_to_fp_bottom_bit_works=yes], [hdf5_cv_sw_ulong_to_fp_bottom_bit_works=no],)])
+ ], [hdf5_cv_ulong_to_fp_bottom_bit_accurate=yes], [hdf5_cv_ulong_to_fp_bottom_bit_accurate=no],)])
else
- AC_CACHE_VAL([hdf5_cv_sw_ulong_to_fp_bottom_bit_works], [hdf5_cv_sw_ulong_to_fp_bottom_bit_works=yes])
+ AC_CACHE_VAL([hdf5_cv_ulong_to_fp_bottom_bit_accurate], [hdf5_cv_ulong_to_fp_bottom_bit_accurate=yes])
fi
-if test ${hdf5_cv_sw_ulong_to_fp_bottom_bit_works} = "yes"; then
- AC_DEFINE([SW_ULONG_TO_FP_BOTTOM_BIT_WORKS], [1],
+if test ${hdf5_cv_ulong_to_fp_bottom_bit_accurate} = "yes"; then
+ AC_DEFINE([ULONG_TO_FP_BOTTOM_BIT_ACCURATE], [1],
[Define if your system can accurately convert unsigned (long) long values to floating-point values.])
AC_MSG_RESULT([yes])
else
@@ -2538,7 +2601,7 @@ dnl than 0.5.
dnl
AC_MSG_CHECKING([if accurately roundup converting floating-point to unsigned long long values])
-AC_CACHE_VAL([hdf5_cv_fp_to_ullong_bottom_bit_works],
+AC_CACHE_VAL([hdf5_fp_to_ullong_accurate],
[AC_TRY_RUN([
int main(void)
{
@@ -2556,11 +2619,11 @@ AC_CACHE_VAL([hdf5_cv_fp_to_ullong_bottom_bit_works],
done:
exit(ret);
}
- ], [hdf5_cv_fp_to_ullong_bottom_bit_works=yes], [hdf5_cv_fp_to_ullong_bottom_bit_works=no],)])
+ ], [hdf5_fp_to_ullong_accurate=yes], [hdf5_fp_to_ullong_accurate=no],)])
-if test ${hdf5_cv_fp_to_ullong_bottom_bit_works} = "yes"; then
- AC_DEFINE([FP_TO_ULLONG_BOTTOM_BIT_WORKS], [1],
- [Define if your system roundup accurately convert floating-point to unsigned long long values.])
+if test ${hdf5_fp_to_ullong_accurate} = "yes"; then
+ AC_DEFINE([FP_TO_ULLONG_ACCURATE], [1],
+ [Define if your system roundup accurately converting floating-point to unsigned long long values.])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
@@ -2575,7 +2638,7 @@ dnl during conversion.
dnl
AC_MSG_CHECKING([if right maximum converting floating-point to unsigned long long values])
-AC_CACHE_VAL([hdf5_cv_fp_to_ullong_right_maximum],
+AC_CACHE_VAL([hdf5_fp_to_ullong_right_maximum],
[AC_TRY_RUN([
int main(void)
{
@@ -2600,9 +2663,9 @@ AC_CACHE_VAL([hdf5_cv_fp_to_ullong_right_maximum],
done:
exit(ret);
}
- ], [hdf5_cv_fp_to_ullong_right_maximum=yes], [hdf5_cv_fp_to_ullong_right_maximum=no],)])
+ ], [hdf5_fp_to_ullong_right_maximum=yes], [hdf5_fp_to_ullong_right_maximum=no],)])
-if test ${hdf5_cv_fp_to_ullong_right_maximum} = "yes"; then
+if test ${hdf5_fp_to_ullong_right_maximum} = "yes"; then
AC_DEFINE([FP_TO_ULLONG_RIGHT_MAXIMUM], [1],
[Define if your system has right maximum convert floating-point to unsigned long long values.])
AC_MSG_RESULT([yes])
@@ -2615,31 +2678,31 @@ dnl Set the flag to indicate that the machine can accurately convert
dnl 'long double' to 'unsigned int' values. (This flag should be set for
dnl all machines, except for some Intel compilers on some Linux.)
dnl
-AC_MSG_CHECKING([if converting long double to unsigned int values works])
-
-if test ${ac_cv_sizeof_long_double}=0; then
- hdf5_cv_ldouble_to_uint_works=${hdf5_cv_ldouble_to_uint_works=no}
-fi
+AC_MSG_CHECKING([if correctly converting long double to unsigned int values])
-AC_CACHE_VAL([hdf5_cv_ldouble_to_uint_works],
- [AC_TRY_RUN([
- int main(void)
- {
- long double ld = 2733248032.9183987530L;
- unsigned int i;
- int ret = 0;
+if test ${ac_cv_sizeof_long_double} = 0; then
+ hdf5_ldouble_to_uint_accurate=${hdf5_ldouble_to_uint_accurate=no}
+else
+ AC_CACHE_VAL([hdf5_ldouble_to_uint_accurate],
+ [AC_TRY_RUN([
+ int main(void)
+ {
+ long double ld = 2733248032.9183987530L;
+ unsigned int i;
+ int ret = 0;
- i = (unsigned int)ld;
- if(i!=2733248032 && i!=2733248031 && i!=2733248033)
- ret = 1;
+ i = (unsigned int)ld;
+ if(i!=2733248032 && i!=2733248031 && i!=2733248033)
+ ret = 1;
-done:
- exit(ret);
- }
- ], [hdf5_cv_ldouble_to_uint_works=yes], [hdf5_cv_ldouble_to_uint_works=no],)])
+ done:
+ exit(ret);
+ }
+ ], [hdf5_ldouble_to_uint_accurate=yes], [hdf5_ldouble_to_uint_accurate=no],)])
+fi
-if test ${hdf5_cv_ldouble_to_uint_works} = "yes"; then
- AC_DEFINE([CV_LDOUBLE_TO_UINT_WORKS], [1],
+if test ${hdf5_ldouble_to_uint_accurate} = "yes"; then
+ AC_DEFINE([LDOUBLE_TO_UINT_ACCURATE], [1],
[Define if your system can convert long double to unsigned int values correctly.])
AC_MSG_RESULT([yes])
else
@@ -2689,88 +2752,88 @@ dnl (This flag should be set for all machines, except for FreeBSD(sleipnir)
dnl where the last 2 bytes of mantissa are lost when compiler tries to do
dnl the conversion, and Cygwin where compiler doesn't do rounding correctly.)
dnl
-AC_MSG_CHECKING([if converting unsigned long long to long double with precision work])
+AC_MSG_CHECKING([if converting unsigned long long to long double with precision])
-if test ${ac_cv_sizeof_long_double}=0; then
- hdf5_cv_ullong_to_ldouble_precision_works=${hdf5_cv_ullong_to_ldouble_precision_works=no}
-fi
-
-AC_CACHE_VAL([hdf5_cv_ullong_to_ldouble_precision_works],
- [AC_TRY_RUN([
- int main(void)
- {
- /* General variables */
- int endian;
- int tst_value = 1;
- int ret = 0;
-
- /* For FreeBSD */
- unsigned long long l = 0xa601e80bda85fcefULL;
- long double ld;
- unsigned char *c1, *c2;
- size_t size;
-
- /* For Cygwin */
- unsigned long long l_cyg = 0xfffffffffffffff0ULL;
- long double ld_cyg;
- unsigned char *c2_cyg;
- size_t size_cyg;
-
-
- /* Determine this system's endianess */
- c1 = (unsigned char*)calloc(1, sizeof(int));
- memcpy((void*)c1, &tst_value, sizeof(int));
- if(c1[0]==1)
- endian = 0; /* little endian */
- else
- endian = 1; /* big endian */
-
- /* For FreeBSD */
- size = sizeof(long double);
- memset(&ld, 0, size);
- ld = (long double)l;
-
- c2 = (unsigned char*)calloc(1, size);
- memcpy((void*)c2, &ld, size);
-
- /* Test if the last 2 bytes of mantissa are lost. Mainly for FreeBSD on Intel
- * architecture(sleipnir) where it happens. */
- /*if(endian==0 && c2[0]==0 && c2[1]==0)*/ /*little endian*/
- if(endian==0 && c2[0]==0) { /*little endian*/
- ret = 1;
- goto done;
+if test ${ac_cv_sizeof_long_double} = 0; then
+ hdf5_cv_ullong_to_ldouble_precision=${hdf5_cv_ullong_to_ldouble_precision=no}
+else
+ AC_CACHE_VAL([hdf5_cv_ullong_to_ldouble_precision],
+ [AC_TRY_RUN([
+ int main(void)
+ {
+ /* General variables */
+ int endian;
+ int tst_value = 1;
+ int ret = 0;
+
+ /* For FreeBSD */
+ unsigned long long l = 0xa601e80bda85fcefULL;
+ long double ld;
+ unsigned char *c1, *c2;
+ size_t size;
+
+ /* For Cygwin */
+ unsigned long long l_cyg = 0xfffffffffffffff0ULL;
+ long double ld_cyg;
+ unsigned char *c2_cyg;
+ size_t size_cyg;
+
+
+ /* Determine this system's endianess */
+ c1 = (unsigned char*)calloc(1, sizeof(int));
+ memcpy((void*)c1, &tst_value, sizeof(int));
+ if(c1[0]==1)
+ endian = 0; /* little endian */
+ else
+ endian = 1; /* big endian */
+
+ /* For FreeBSD */
+ size = sizeof(long double);
+ memset(&ld, 0, size);
+ ld = (long double)l;
+
+ c2 = (unsigned char*)calloc(1, size);
+ memcpy((void*)c2, &ld, size);
+
+ /* Test if the last 2 bytes of mantissa are lost. Mainly for FreeBSD on Intel
+ * architecture(sleipnir) where it happens. */
+ /*if(endian==0 && c2[0]==0 && c2[1]==0)*/ /*little endian*/
+ if(endian==0 && c2[0]==0) { /*little endian*/
+ ret = 1;
+ goto done;
+ }
+
+ /* For Cygwin */
+ size_cyg = sizeof(long double);
+ memset(&ld_cyg, 0, size);
+ ld_cyg = (long double)l_cyg;
+
+ c2_cyg = (unsigned char*)calloc(1, size_cyg);
+ memcpy((void*)c2_cyg, &ld_cyg, size_cyg);
+
+ /* Test if the last 4 bytes(roughly) of mantissa are rounded up. Mainly for Cygwin
+ * where the values like 0xffffffffffffffff, 0xfffffffffffffffe, ...,
+ * 0xfffffffffffff000 ... are rounded up as 0x0000403f8000000000000000
+ * instead of 0x0000403effffffffffffffff, 0x0000403efffffffffffffffe, ...,
+ * 0x0000403efffffffffffff000 ...
+ */
+ if(endian==0 && c2_cyg[0]==0 && c2_cyg[1]==0 && c2_cyg[2]==0 && c2_cyg[3]==0)
+ ret = 1;
+
+ done:
+ if(c1)
+ free(c1);
+ if(c2)
+ free(c2);
+ if(c2_cyg)
+ free(c2_cyg);
+ exit(ret);
}
+ ], [hdf5_cv_ullong_to_ldouble_precision=yes], [hdf5_cv_ullong_to_ldouble_precision=no],)])
+fi
- /* For Cygwin */
- size_cyg = sizeof(long double);
- memset(&ld_cyg, 0, size);
- ld_cyg = (long double)l_cyg;
-
- c2_cyg = (unsigned char*)calloc(1, size_cyg);
- memcpy((void*)c2_cyg, &ld_cyg, size_cyg);
-
- /* Test if the last 4 bytes(roughly) of mantissa are rounded up. Mainly for Cygwin
- * where the values like 0xffffffffffffffff, 0xfffffffffffffffe, ...,
- * 0xfffffffffffff000 ... are rounded up as 0x0000403f8000000000000000
- * instead of 0x0000403effffffffffffffff, 0x0000403efffffffffffffffe, ...,
- * 0x0000403efffffffffffff000 ...
- */
- if(endian==0 && c2_cyg[0]==0 && c2_cyg[1]==0 && c2_cyg[2]==0 && c2_cyg[3]==0)
- ret = 1;
-
-done:
- if(c1)
- free(c1);
- if(c2)
- free(c2);
- if(c2_cyg)
- free(c2_cyg);
- exit(ret);
- }
- ], [hdf5_cv_ullong_to_ldouble_precision_works=yes], [hdf5_cv_ullong_to_ldouble_precision_works=no],)])
-
-if test ${hdf5_cv_ullong_to_ldouble_precision_works} = "yes"; then
- AC_DEFINE([ULLONG_TO_LDOUBLE_PRECISION_WORKS], [1],
+if test ${hdf5_cv_ullong_to_ldouble_precision} = "yes"; then
+ AC_DEFINE([ULLONG_TO_LDOUBLE_PRECISION], [1],
[Define if your system can convert unsigned long long to long double with correct precision.])
AC_MSG_RESULT([yes])
else
diff --git a/src/H5T.c b/src/H5T.c
index 1894f33..7e4754e 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1001,16 +1001,16 @@ H5T_init_interface(void)
*/
/* floating point */
-#if H5_CONVERT_DENORMAL_FLOAT
+#if FP_FP
status |= H5T_register(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T_conv_float_double, H5AC_dxpl_id);
status |= H5T_register(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T_conv_double_float, H5AC_dxpl_id);
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#endif /*FP_FP*/
+#if FP_LDOUBLE
status |= H5T_register(H5T_PERS_HARD, "flt_ldbl", native_float, native_ldouble, H5T_conv_float_ldouble, H5AC_dxpl_id);
status |= H5T_register(H5T_PERS_HARD, "dbl_ldbl", native_double, native_ldouble, H5T_conv_double_ldouble, H5AC_dxpl_id);
status |= H5T_register(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T_conv_ldouble_float, H5AC_dxpl_id);
status |= H5T_register(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T_conv_ldouble_double, H5AC_dxpl_id);
-#endif
-#endif /*H5_CONVERT_DENORMAL_FLOAT*/
+#endif /*FP_LDOUBLE*/
/* from long_long */
status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T_conv_llong_ullong, H5AC_dxpl_id);
@@ -1115,149 +1115,149 @@ 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);
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
status |= H5T_register(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T_conv_schar_ldouble, H5AC_dxpl_id);
-#endif /* H5_SW_INTEGER_TO_LDOUBLE_WORKS */
+#endif /* INTEGER_LDOUBLE */
/* 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);
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
status |= H5T_register(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T_conv_uchar_ldouble, H5AC_dxpl_id);
-#endif /*H5_SW_INTEGER_TO_LDOUBLE_WORKS*/
+#endif /* INTEGER_LDOUBLE */
/* 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);
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
status |= H5T_register(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T_conv_short_ldouble, H5AC_dxpl_id);
-#endif /*H5_SW_INTEGER_TO_LDOUBLE_WORKS*/
+#endif /* INTEGER_LDOUBLE */
/* 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);
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
status |= H5T_register(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble, H5T_conv_ushort_ldouble, H5AC_dxpl_id);
-#endif /*H5_SW_INTEGER_TO_LDOUBLE_WORKS*/
+#endif /* INTEGER_LDOUBLE */
/* 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);
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
status |= H5T_register(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T_conv_int_ldouble, H5AC_dxpl_id);
-#endif /*H5_SW_INTEGER_TO_LDOUBLE_WORKS*/
+#endif /* INTEGER_LDOUBLE */
/* 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);
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
status |= H5T_register(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T_conv_uint_ldouble, H5AC_dxpl_id);
-#endif /*H5_SW_INTEGER_TO_LDOUBLE_WORKS*/
+#endif /* INTEGER_LDOUBLE */
/* 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);
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
status |= H5T_register(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T_conv_long_ldouble, H5AC_dxpl_id);
-#endif /*H5_SW_INTEGER_TO_LDOUBLE_WORKS*/
+#endif /* INTEGER_LDOUBLE */
/* From unsigned long to floats */
-#if H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS
+#if ULONG_FP
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);
-#endif /* H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS */
-#if H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS && H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#endif /* ULONG_FP */
+#if ULONG_LDOUBLE
status |= H5T_register(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T_conv_ulong_ldouble, H5AC_dxpl_id);
-#endif /* H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS && H5_SW_INTEGER_TO_LDOUBLE_WORKS */
+#endif /* ULONG_LDOUBLE */
/* 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);
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T_conv_llong_ldouble, H5AC_dxpl_id);
-#endif /* H5_SW_INTEGER_TO_LDOUBLE_WORKS */
+#endif /* INTEGER_LDOUBLE */
/* From unsigned long long to floats */
-#if H5_ULLONG_TO_FP_CAST_WORKS && H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS
+#if ULLONG_FP
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);
-#if H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS
+#endif /* ULLONG_FP */
+#if ULLONG_LDOUBLE
status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T_conv_ullong_ldouble, H5AC_dxpl_id);
-#endif /* H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS */
-#endif /* H5_ULLONG_TO_FP_CAST_WORKS && H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS */
+#endif /* ULLONG_LDOUBLE */
/* 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);
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if LDOUBLE_INTEGER
status |= H5T_register(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T_conv_ldouble_schar, H5AC_dxpl_id);
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /* 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);
status |= H5T_register(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T_conv_double_uchar, H5AC_dxpl_id);
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if LDOUBLE_INTEGER
status |= H5T_register(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T_conv_ldouble_uchar, H5AC_dxpl_id);
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /* 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);
status |= H5T_register(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T_conv_double_short, H5AC_dxpl_id);
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if LDOUBLE_INTEGER
status |= H5T_register(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T_conv_ldouble_short, H5AC_dxpl_id);
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /* 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);
status |= H5T_register(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T_conv_double_ushort, H5AC_dxpl_id);
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if LDOUBLE_INTEGER
status |= H5T_register(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T_conv_ldouble_ushort, H5AC_dxpl_id);
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /* 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);
status |= H5T_register(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T_conv_double_int, H5AC_dxpl_id);
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if LDOUBLE_INTEGER
status |= H5T_register(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T_conv_ldouble_int, H5AC_dxpl_id);
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /* 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);
status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T_conv_double_uint, H5AC_dxpl_id);
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS && H5_CV_LDOUBLE_TO_UINT_WORKS
+#if LDOUBLE_UINT
status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T_conv_ldouble_uint, H5AC_dxpl_id);
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS && H5_CV_LDOUBLE_TO_UINT_WORKS */
+#endif /* LDOUBLE_UINT */
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);
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if LDOUBLE_INTEGER
status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T_conv_ldouble_long, H5AC_dxpl_id);
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /* 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);
status |= H5T_register(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T_conv_double_ulong, H5AC_dxpl_id);
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if LDOUBLE_INTEGER
status |= H5T_register(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T_conv_ldouble_ulong, H5AC_dxpl_id);
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /* LDOUBLE_INTEGER */
/* From floats to long long */
-#ifndef H5_HW_FP_TO_LLONG_NOT_WORKS
+#if FP_LLONG
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);
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#endif /* FP_LLONG */
+#if LDOUBLE_LLONG
status |= H5T_register(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T_conv_ldouble_llong, H5AC_dxpl_id);
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
-#endif /* !H5_HW_FP_TO_LLONG_NOT_WORKS */
+#endif /* LDOUBLE_LLONG */
/* From floats to unsigned long long */
-#if H5_FP_TO_ULLONG_BOTTOM_BIT_WORKS && H5_FP_TO_ULLONG_RIGHT_MAXIMUM
+#if FP_ULLONG
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);
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#endif /* FP_ULLONG */
+#if LDOUBLE_ULLONG
status |= H5T_register(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T_conv_ldouble_ullong, H5AC_dxpl_id);
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
-#endif /* H5_FP_TO_ULLONG_BOTTOM_BIT_WORKS && H5_FP_TO_ULLONG_RIGHT_MAXIMUM */
+#endif /* LDOUBLE_ULLONG */
/*
* 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 cb1c38a..9da5842 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -190,6 +190,7 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
* equal. In this case, do not return exception but make sure the maximum is assigned
* to the destination. SLU - 2005/06/29
*/
+#ifdef H5_WANT_DCONV_EXCEPTION
#define H5T_CONV_Xx_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
if (*((ST*)S) > (DT)(D_MAX)) { \
if(cb_struct.func) { \
@@ -226,7 +227,13 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
} else \
*((DT*)D) = (DT)(*((ST*)S)); \
}
+#else
+#define H5T_CONV_Xx_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ *((DT*)D) = (DT)(*((ST*)S)); \
+}
+#endif
+#ifdef H5_WANT_DCONV_EXCEPTION
#define H5T_CONV_Ux_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
if (*((ST*)S) > (DT)(D_MAX)) { \
if(cb_struct.func) { \
@@ -246,12 +253,18 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
} else \
*((DT*)D) = (DT)(*((ST*)S)); \
}
+#else
+#define H5T_CONV_Ux_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ *((DT*)D) = (DT)(*((ST*)S)); \
+}
+#endif
#define H5T_CONV_sS(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)<=sizeof(DT)); \
H5T_CONV(H5T_CONV_xX, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
+#ifdef H5_WANT_DCONV_EXCEPTION
#define H5T_CONV_sU_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
if (*((ST*)S) < 0) { \
if(cb_struct.func) { \
@@ -271,23 +284,29 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
} else \
*((DT*)D) = (DT)(*((ST*)S)); \
}
+#else
+#define H5T_CONV_sU_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ *((DT*)D) = (DT)(*((ST*)S)); \
+}
+#endif
#define H5T_CONV_sU(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)<=sizeof(DT)); \
H5T_CONV(H5T_CONV_sU, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
+#ifdef H5_WANT_DCONV_EXCEPTION
#define H5T_CONV_uS_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
if (sizeof(ST)==sizeof(DT) && *((ST*)S) > (D_MAX)) { \
if(cb_struct.func) { \
- H5T_conv_ret_t except_ret; /*callback return*/ \
- \
- except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
- src_id, dst_id, S, D, cb_struct.user_data); \
- if(except_ret == H5T_CONV_UNHANDLED) \
- /* Let compiler convert if case is ignored by user handler*/ \
+ H5T_conv_ret_t except_ret; /*callback return*/ \
+ \
+ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
+ src_id, dst_id, S, D, cb_struct.user_data); \
+ if(except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
*((DT*)D) = (D_MAX); \
- else if(except_ret == H5T_CONV_ABORT) \
+ else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} \
@@ -296,6 +315,11 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
} else \
*((DT*)D) = (DT)(*((ST*)S)); \
}
+#else
+#define H5T_CONV_uS_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ *((DT*)D) = (DT)(*((ST*)S)); \
+}
+#endif
#define H5T_CONV_uS(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)<=sizeof(DT)); \
@@ -312,6 +336,7 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
H5T_CONV(H5T_CONV_Xx, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
+#ifdef H5_WANT_DCONV_EXCEPTION
#define H5T_CONV_Su_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
if (*((ST*)S) < 0) { \
if(cb_struct.func) { \
@@ -346,6 +371,11 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
} else \
*((DT*)D) = (DT)(*((ST*)S)); \
}
+#else
+#define H5T_CONV_Su_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ *((DT*)D) = (DT)(*((ST*)S)); \
+}
+#endif
#define H5T_CONV_Su(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)>=sizeof(DT)); \
@@ -362,6 +392,7 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
H5T_CONV(H5T_CONV_Ux, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
+#ifdef H5_WANT_DCONV_EXCEPTION
#define H5T_CONV_su_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
/* Assumes memory format of unsigned & signed integers is same */ \
if (*((ST*)S) < 0) { \
@@ -379,14 +410,21 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
} \
else \
*((DT*)D) = 0; \
- } \
+ } else \
+ *((DT*)D) = (DT)(*((ST*)S)); \
}
+#else
+#define H5T_CONV_su_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ *((DT*)D) = (DT)(*((ST*)S)); \
+}
+#endif
#define H5T_CONV_su(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)==sizeof(DT)); \
H5T_CONV(H5T_CONV_su, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
+#ifdef H5_WANT_DCONV_EXCEPTION
#define H5T_CONV_us_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
/* Assumes memory format of unsigned & signed integers is same */ \
if (*((ST*)S) > (DT)(D_MAX)) { \
@@ -404,8 +442,14 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
} \
else \
*((DT*)D) = (D_MAX); \
- } \
+ } else \
+ *((DT*)D) = (DT)(*((ST*)S)); \
+}
+#else
+#define H5T_CONV_us_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ *((DT*)D) = (DT)(*((ST*)S)); \
}
+#endif
#define H5T_CONV_us(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)==sizeof(DT)); \
@@ -420,6 +464,7 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
/* Same as H5T_CONV_Xx_CORE, except that instead of using D_MAX and D_MIN
* when an overflow occurs, use the 'float' infinity values.
*/
+#ifdef H5_WANT_DCONV_EXCEPTION
#define H5T_CONV_Ff_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
if (*((ST*)S) > (DT)(D_MAX)) { \
if(cb_struct.func) { \
@@ -454,6 +499,11 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
} else \
*((DT*)D) = (DT)(*((ST*)S)); \
}
+#else
+#define H5T_CONV_Ff_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ *((DT*)D) = (DT)(*((ST*)S)); \
+}
+#endif
#define H5T_CONV_Ff(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)>=sizeof(DT)); \
@@ -7057,7 +7107,7 @@ done:
* destination values are packed.
*-------------------------------------------------------------------------
*/
-#if H5_CONVERT_DENORMAL_FLOAT
+#if FP_FP
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,
@@ -7073,7 +7123,7 @@ H5T_conv_float_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_CONVERT_DENORMAL_FLOAT */
+#endif /* FP_FP */
/*-------------------------------------------------------------------------
@@ -7091,7 +7141,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_CONVERT_DENORMAL_FLOAT && H5_SIZEOF_LONG_DOUBLE !=0
+#if FP_LDOUBLE
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,
@@ -7107,7 +7157,7 @@ H5T_conv_float_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_CONVERT_DENORMAL_FLOAT && H5_SIZEOF_LONG_DOUBLE !=0 */
+#endif /*FP_LDOUBLE*/
/*-------------------------------------------------------------------------
@@ -7132,7 +7182,7 @@ done:
* destination values are packed.
*-------------------------------------------------------------------------
*/
-#if H5_CONVERT_DENORMAL_FLOAT
+#if FP_FP
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,
@@ -7148,7 +7198,7 @@ H5T_conv_double_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /*H5_CONVERT_DENORMAL_FLOAT*/
+#endif /*FP_FP*/
/*-------------------------------------------------------------------------
@@ -7166,7 +7216,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_CONVERT_DENORMAL_FLOAT && H5_SIZEOF_LONG_DOUBLE !=0
+#if FP_LDOUBLE
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,
@@ -7183,7 +7233,7 @@ H5T_conv_double_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_CONVERT_DENORMAL_FLOAT && H5_SIZEOF_LONG_DOUBLE !=0 */
+#endif /*FP_LDOUBLE*/
/*-------------------------------------------------------------------------
@@ -7201,7 +7251,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_CONVERT_DENORMAL_FLOAT && H5_SIZEOF_LONG_DOUBLE !=0
+#if FP_LDOUBLE
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,
@@ -7217,7 +7267,7 @@ H5T_conv_ldouble_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_CONVERT_DENORMAL_FLOAT && H5_SIZEOF_LONG_DOUBLE !=0 */
+#endif /* FP_LDOUBLE */
/*-------------------------------------------------------------------------
@@ -7235,7 +7285,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_CONVERT_DENORMAL_FLOAT && H5_SIZEOF_LONG_DOUBLE !=0
+#if FP_LDOUBLE
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,
@@ -7251,7 +7301,7 @@ H5T_conv_ldouble_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_CONVERT_DENORMAL_FLOAT && H5_SIZEOF_LONG_DOUBLE !=0 */
+#endif /*FP_LDOUBLE*/
/*-------------------------------------------------------------------------
@@ -7333,7 +7383,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
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,
@@ -7349,7 +7399,7 @@ H5T_conv_schar_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_INTEGER_TO_LDOUBLE_WORKS */
+#endif /* INTEGER_LDOUBLE */
/*-------------------------------------------------------------------------
@@ -7431,7 +7481,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
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,
@@ -7447,7 +7497,7 @@ H5T_conv_uchar_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_INTEGER_TO_LDOUBLE_WORKS */
+#endif /* INTEGER_LDOUBLE */
/*-------------------------------------------------------------------------
@@ -7529,7 +7579,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
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,
@@ -7545,7 +7595,7 @@ H5T_conv_short_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_INTEGER_TO_LDOUBLE_WORKS */
+#endif /* INTEGER_LDOUBLE */
/*-------------------------------------------------------------------------
@@ -7627,7 +7677,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
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,
@@ -7643,7 +7693,7 @@ H5T_conv_ushort_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_INTEGER_TO_LDOUBLE_WORKS */
+#endif /* INTEGER_LDOUBLE */
/*-------------------------------------------------------------------------
@@ -7725,7 +7775,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
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,
@@ -7741,7 +7791,7 @@ H5T_conv_int_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_INTEGER_TO_LDOUBLE_WORKS */
+#endif /* INTEGER_LDOUBLE */
/*-------------------------------------------------------------------------
@@ -7823,7 +7873,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
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,
@@ -7839,7 +7889,7 @@ H5T_conv_uint_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_INTEGER_TO_LDOUBLE_WORKS */
+#endif /* INTEGER_LDOUBLE */
/*-------------------------------------------------------------------------
@@ -7921,7 +7971,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
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,
@@ -7937,7 +7987,7 @@ H5T_conv_long_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_INTEGER_TO_LDOUBLE_WORKS */
+#endif /* INTEGER_LDOUBLE */
/*-------------------------------------------------------------------------
@@ -7955,7 +8005,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS
+#if ULONG_FP
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,
@@ -7971,7 +8021,7 @@ H5T_conv_ulong_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS */
+#endif /* ULONG_FP */
/*-------------------------------------------------------------------------
@@ -7989,7 +8039,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS
+#if ULONG_FP
herr_t
H5T_conv_ulong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
@@ -8005,7 +8055,7 @@ H5T_conv_ulong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS */
+#endif /* ULONG_FP */
/*-------------------------------------------------------------------------
@@ -8023,7 +8073,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS && H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if ULONG_LDOUBLE
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,
@@ -8039,7 +8089,7 @@ H5T_conv_ulong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS && H5_SW_INTEGER_TO_LDOUBLE_WORKS */
+#endif /* ULONG_LDOUBLE */
/*-------------------------------------------------------------------------
@@ -8121,7 +8171,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if INTEGER_LDOUBLE
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,
@@ -8137,9 +8187,8 @@ H5T_conv_llong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_INTEGER_TO_LDOUBLE_WORKS */
+#endif /* INTEGER_LDOUBLE */
-#if H5_ULLONG_TO_FP_CAST_WORKS && H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS
/*-------------------------------------------------------------------------
* Function: H5T_conv_ullong_float
@@ -8156,6 +8205,7 @@ done:
*
*-------------------------------------------------------------------------
*/
+#if ULLONG_FP
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,
@@ -8171,6 +8221,7 @@ H5T_conv_ullong_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
+#endif /*ULLONG_FP*/
/*-------------------------------------------------------------------------
@@ -8188,6 +8239,7 @@ done:
*
*-------------------------------------------------------------------------
*/
+#if ULLONG_FP
herr_t
H5T_conv_ullong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
@@ -8203,6 +8255,7 @@ H5T_conv_ullong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
+#endif /*ULLONG_FP*/
/*-------------------------------------------------------------------------
@@ -8220,7 +8273,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS
+#if ULLONG_LDOUBLE
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,
@@ -8236,8 +8289,7 @@ 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_LDOUBLE_PRECISION_WORKS */
-#endif /* H5_ULLONG_TO_FP_CAST_WORKS && H5_SW_ULONG_TO_FP_BOTTOM_BIT_WORKS */
+#endif /*ULLONG_LDOUBLE*/
/*-------------------------------------------------------------------------
@@ -8383,7 +8435,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if 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,
@@ -8399,7 +8451,7 @@ H5T_conv_ldouble_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /* LDOUBLE_INTEGER */
/*-------------------------------------------------------------------------
@@ -8417,7 +8469,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if 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,
@@ -8433,7 +8485,7 @@ H5T_conv_ldouble_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /* LDOUBLE_INTEGER */
/*-------------------------------------------------------------------------
@@ -8579,7 +8631,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if 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,
@@ -8595,7 +8647,7 @@ H5T_conv_ldouble_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /* LDOUBLE_INTEGER */
/*-------------------------------------------------------------------------
@@ -8613,7 +8665,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if 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,
@@ -8629,7 +8681,7 @@ H5T_conv_ldouble_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /* LDOUBLE_INTEGER */
/*-------------------------------------------------------------------------
@@ -8775,7 +8827,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if 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,
@@ -8791,7 +8843,7 @@ H5T_conv_ldouble_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /* LDOUBLE_INTEGER */
/*-------------------------------------------------------------------------
@@ -8809,7 +8861,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS && H5_CV_LDOUBLE_TO_UINT_WORKS
+#if LDOUBLE_UINT
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,
@@ -8825,7 +8877,7 @@ H5T_conv_ldouble_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS && H5_CV_LDOUBLE_TO_UINT_WORKS */
+#endif /* LDOUBLE_UINT */
/*-------------------------------------------------------------------------
@@ -8971,7 +9023,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if 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,
@@ -8987,7 +9039,7 @@ H5T_conv_ldouble_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /*H5_SW_LDOUBLE_TO_INTEGER_WORKS*/
+#endif /*LDOUBLE_INTEGER*/
/*-------------------------------------------------------------------------
@@ -9005,7 +9057,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if 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,
@@ -9021,7 +9073,7 @@ H5T_conv_ldouble_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /* LDOUBLE_INTEGER */
/*-------------------------------------------------------------------------
@@ -9039,7 +9091,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#ifndef H5_HW_FP_TO_LLONG_NOT_WORKS
+#if FP_LLONG
herr_t
H5T_conv_float_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
@@ -9055,7 +9107,7 @@ H5T_conv_float_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* !H5_HW_FP_TO_LLONG_NOT_WORKS */
+#endif /* FP_LLONG */
/*-------------------------------------------------------------------------
@@ -9073,7 +9125,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_FP_TO_ULLONG_BOTTOM_BIT_WORKS && H5_FP_TO_ULLONG_RIGHT_MAXIMUM
+#if FP_ULLONG
herr_t
H5T_conv_float_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
@@ -9089,7 +9141,7 @@ H5T_conv_float_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_FP_TO_ULLONG_BOTTOM_BIT_WORKS && H5_FP_TO_ULLONG_RIGHT_MAXIMUM */
+#endif /*FP_ULLONG*/
/*-------------------------------------------------------------------------
@@ -9107,7 +9159,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#ifndef H5_HW_FP_TO_LLONG_NOT_WORKS
+#if FP_LLONG
herr_t
H5T_conv_double_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
@@ -9123,7 +9175,7 @@ H5T_conv_double_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* !H5_HW_FP_TO_LLONG_NOT_WORKS */
+#endif /*FP_LLONG*/
/*-------------------------------------------------------------------------
@@ -9141,7 +9193,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_FP_TO_ULLONG_BOTTOM_BIT_WORKS && H5_FP_TO_ULLONG_RIGHT_MAXIMUM
+#if FP_ULLONG
herr_t
H5T_conv_double_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
@@ -9157,7 +9209,7 @@ H5T_conv_double_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_FP_TO_ULLONG_BOTTOM_BIT_WORKS && H5_FP_TO_ULLONG_RIGHT_MAXIMUM */
+#endif /*FP_ULLONG*/
/*-------------------------------------------------------------------------
@@ -9175,7 +9227,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if !H5_HW_FP_TO_LLONG_NOT_WORKS && H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if LDOUBLE_LLONG
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,
@@ -9191,7 +9243,7 @@ H5T_conv_ldouble_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* !H5_HW_FP_TO_LLONG_NOT_WORKS && H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /*LDOUBLE_LLONG*/
/*-------------------------------------------------------------------------
@@ -9209,7 +9261,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5_FP_TO_ULLONG_BOTTOM_BIT_WORKS && H5_FP_TO_ULLONG_RIGHT_MAXIMUM && H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if LDOUBLE_ULLONG
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,
@@ -9225,7 +9277,7 @@ H5T_conv_ldouble_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5_FP_TO_ULLONG_BOTTOM_BIT_WORKS && H5_FP_TO_ULLONG_RIGHT_MAXIMUM && H5_SW_LDOUBLE_TO_INTEGER_WORKS */
+#endif /*LDOUBLE_ULLONG*/
/*-------------------------------------------------------------------------
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 6854bc2..1f406e8 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -64,6 +64,102 @@
/* Macro to ease detecting atomic datatypes */
#define H5T_IS_ATOMIC(dt) (!(H5T_IS_COMPLEX((dt)->type) || (dt)->type==H5T_OPAQUE))
+
+/* Define an interim macro for converting between floating number(float and double) and floating number.
+ * All Cray compilers don't support denormalized floating values generating exception(?). */
+#if H5_CONVERT_DENORMAL_FLOAT
+#define FP_FP 1
+#endif /*H5_CONVERT_DENORMAL_FLOAT*/
+
+/* Define an interim macro for converting between floating number(float and double) and long double.
+ * All Cray compilers don't support denormalized floating values generating exception(?). NEC doesn't
+ * support long double. */
+#if H5_SIZEOF_LONG_DOUBLE && H5_CONVERT_DENORMAL_FLOAT
+#define FP_LDOUBLE 1
+#endif /*H5_SIZEOF_LONG_DOUBLE && H5_CONVERT_DENORMAL_FLOAT*/
+
+/* Define an interim macro for converting all integers to long double. SGI compilers give some
+ * incorrect conversions. */
+#if (H5_WANT_DATA_ACCURACY && H5_INTEGER_TO_LDOUBLE_ACCURATE) || (!H5_WANT_DATA_ACCURACY)
+#define INTEGER_LDOUBLE 1
+#endif
+
+/* Define an interim macro for converting unsigned (long) long to floating numbers.
+ * 64-bit Solaris does different rounding. */
+#if (H5_WANT_DATA_ACCURACY && H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE) || (!H5_WANT_DATA_ACCURACY)
+#define ULONG_FP 1
+#endif
+
+/* Define an interim macro for converting unsigned long to long double. SGI compilers give some
+ * incorrect conversions. 64-bit Solaris does different rounding. */
+#if (H5_WANT_DATA_ACCURACY && H5_INTEGER_TO_LDOUBLE_ACCURATE && H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE) || \
+ (!H5_WANT_DATA_ACCURACY)
+#define ULONG_LDOUBLE 1
+#endif
+
+/* Define an interim macro for converting unsigned long long to floating numbers. SGI compilers give
+ * some incorect conversion. 64-bit Solaris does different rounding. Windows Visual Studio 6 does
+ * not support unsigned long long. */
+#if (H5_WANT_DATA_ACCURACY && H5_ULLONG_TO_FP_CAST_WORKS && H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE) || \
+ (!H5_WANT_DATA_ACCURACY && H5_ULLONG_TO_FP_CAST_WORKS)
+#define ULLONG_FP 1
+#endif
+
+/* Define an interim macro for converting unsigned long long to long double. SGI compilers give
+ * some incorect conversion. 64-bit Solaris does different rounding. Windows Visual Studio 6 does
+ * not support unsigned long long. For FreeBSD(sleipnir), the last 2 bytes of mantissa are lost when
+ * compiler tries to do the conversion. For Cygwin, compiler doesn't do rounding correctly. */
+#if (H5_WANT_DATA_ACCURACY && H5_ULLONG_TO_FP_CAST_WORKS && H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE && \
+ H5_ULLONG_TO_LDOUBLE_PRECISION) || (!H5_WANT_DATA_ACCURACY && H5_ULLONG_TO_FP_CAST_WORKS)
+#define ULLONG_LDOUBLE 1
+#endif
+
+/* Define an interim 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_ACCURATE && H5_LDOUBLE_TO_INTEGER_WORKS) || \
+ (!H5_WANT_DATA_ACCURACY && H5_LDOUBLE_TO_INTEGER_WORKS)
+#define LDOUBLE_INTEGER 1
+#endif
+
+/* Define an interim 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_INTEGER_ACCURATE && H5_LDOUBLE_TO_UINT_ACCURATE && \
+ H5_LDOUBLE_TO_INTEGER_WORKS) || (!H5_WANT_DATA_ACCURACY && H5_LDOUBLE_TO_INTEGER_WORKS)
+#define LDOUBLE_UINT 1
+#endif
+
+/* Define an interim macro for converting floating numbers to long long. The hard conversion on Windows
+ * .NET 2003 has a bug and gives wrong exception value. */
+#if (H5_WANT_DATA_ACCURACY && !H5_HW_FP_TO_LLONG_NOT_WORKS) || (!H5_WANT_DATA_ACCURACY)
+#define FP_LLONG 1
+#endif
+
+/* Define an interim macro for converting long double to long long. SGI compilers give some 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 && !H5_HW_FP_TO_LLONG_NOT_WORKS && H5_LDOUBLE_TO_INTEGER_ACCURATE && \
+ H5_LDOUBLE_TO_INTEGER_WORKS) || \
+ (!H5_WANT_DATA_ACCURACY && !H5_HW_FP_TO_LLONG_NOT_WORKS && H5_LDOUBLE_TO_INTEGER_WORKS)
+#define LDOUBLE_LLONG 1
+#endif
+
+/* Define an interim macro for converting floating numbers to unsigned long long. PGI compiler does
+ * roundup when the source fraction part is greater than 0.5. HP-UX compilers set the maximal number
+ * for unsigned long long as 0x7fffffffffffffff during conversion. */
+#if (H5_WANT_DATA_ACCURACY && H5_FP_TO_ULLONG_ACCURATE && H5_FP_TO_ULLONG_RIGHT_MAXIMUM) || \
+ (!H5_WANT_DATA_ACCURACY)
+#define FP_ULLONG 1
+#endif
+
+/* Define an interim 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_ACCURATE && H5_LDOUBLE_TO_INTEGER_WORKS && \
+ H5_FP_TO_ULLONG_ACCURATE && H5_FP_TO_ULLONG_RIGHT_MAXIMUM) || \
+ (!H5_WANT_DATA_ACCURACY && H5_LDOUBLE_TO_INTEGER_WORKS)
+#define LDOUBLE_ULLONG 1
+#endif
+
/* Statistics about a conversion function */
struct H5T_stats_t {
unsigned ncalls; /*num calls to conversion function */
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 0fb003c..e20fdbe 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -4,10 +4,6 @@
values. */
#undef CONVERT_DENORMAL_FLOAT
-/* Define if your system can convert long double to unsigned int values
- correctly. */
-#undef CV_LDOUBLE_TO_UINT_WORKS
-
/* Define if `dev_t' is a scalar */
#undef DEV_T_IS_SCALAR
@@ -29,9 +25,9 @@
integer values. */
#undef FP_TO_INTEGER_OVERFLOW_WORKS
-/* Define if your system roundup accurately convert floating-point to unsigned
- long long values. */
-#undef FP_TO_ULLONG_BOTTOM_BIT_WORKS
+/* Define if your system roundup accurately converting floating-point to
+ unsigned long long values. */
+#undef FP_TO_ULLONG_ACCURATE
/* Define if your system has right maximum convert floating-point to unsigned
long long values. */
@@ -361,6 +357,20 @@
/* Define if `__tm_gmtoff' is a member of `struct tm' */
#undef HAVE___TM_GMTOFF
+/* Define if your system can accurately convert from integers to long double
+ values. */
+#undef INTEGER_TO_LDOUBLE_ACCURATE
+
+/* Define if your system can convert long double to integers accurately. */
+#undef LDOUBLE_TO_INTEGER_ACCURATE
+
+/* Define if your system can convert from long double to integer values. */
+#undef LDOUBLE_TO_INTEGER_WORKS
+
+/* Define if your system can convert long double to unsigned int values
+ correctly. */
+#undef LDOUBLE_TO_UINT_ACCURATE
+
/* Define if your system can compile long long to floating-point casts. */
#undef LLONG_TO_FP_CAST_WORKS
@@ -507,18 +517,6 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
-/* Define if your system can accurately convert from integers to long double
- values. */
-#undef SW_INTEGER_TO_LDOUBLE_WORKS
-
-/* Define if your system can accurately convert from long double to integer
- values. */
-#undef SW_LDOUBLE_TO_INTEGER_WORKS
-
-/* Define if your system can accurately convert unsigned (long) long values to
- floating-point values. */
-#undef SW_ULONG_TO_FP_BOTTOM_BIT_WORKS
-
/* Define if your system supports pthread_attr_setscope(&attribute,
PTHREAD_SCOPE_SYSTEM) call. */
#undef SYSTEM_SCOPE_THREADS
@@ -535,7 +533,11 @@
/* Define if your system can convert unsigned long long to long double with
correct precision. */
-#undef ULLONG_TO_LDOUBLE_PRECISION_WORKS
+#undef ULLONG_TO_LDOUBLE_PRECISION
+
+/* Define if your system can accurately convert unsigned (long) long values to
+ floating-point values. */
+#undef ULONG_TO_FP_BOTTOM_BIT_ACCURATE
/* Version number of package */
#undef VERSION
@@ -544,6 +546,12 @@
don't fit into size allowed */
#undef VSNPRINTF_WORKS
+/* Data accuracy is prefered to speed during data conversions */
+#undef WANT_DATA_ACCURACY
+
+/* Check exception handling functions during data conversions */
+#undef WANT_DCONV_EXCEPTION
+
/* Define if the HDF5 v1.6 compatibility functions are to be compiled in */
#undef WANT_H5_V1_6_COMPAT
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 8eeefff..a760c00 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -1518,44 +1518,44 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw = (unsigned char*)&hw_char;
switch (src_type) {
case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char));
- hw_char = (char)(*((char*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
+ hw_char = (signed char)(*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_char = (char)(*((unsigned char*)aligned));
+ hw_char = (signed char)(*((unsigned char*)aligned));
break;
case INT_SHORT:
HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_char = (char)(*((short*)aligned));
+ hw_char = (signed char)(*((short*)aligned));
break;
case INT_USHORT:
HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_char = (char)(*((unsigned short*)aligned));
+ hw_char = (signed char)(*((unsigned short*)aligned));
break;
case INT_INT:
HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_char = (char)(*((int*)aligned));
+ hw_char = (signed char)(*((int*)aligned));
break;
case INT_UINT:
HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_char = (char)(*((unsigned*)aligned));
+ hw_char = (signed char)(*((unsigned*)aligned));
break;
case INT_LONG:
HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_char = (char)(*((long*)aligned));
+ hw_char = (signed char)(*((long*)aligned));
break;
case INT_ULONG:
HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_char = (char)(*((unsigned long*)aligned));
+ hw_char = (signed char)(*((unsigned long*)aligned));
break;
case INT_LLONG:
HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_char = (char)(*((long_long*)aligned));
+ hw_char = (signed char)(*((long_long*)aligned));
break;
case INT_ULLONG:
HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_char = (char)(*((unsigned long_long*)aligned));
+ hw_char = (signed char)(*((unsigned long_long*)aligned));
break;
default:
break;
@@ -1564,8 +1564,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw = (unsigned char*)&hw_uchar;
switch (src_type) {
case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char));
- hw_uchar = (unsigned char)(*((char*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
+ hw_uchar = (unsigned char)(*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
@@ -1657,8 +1657,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw = (unsigned char*)&hw_ushort;
switch (src_type) {
case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char));
- hw_ushort = (unsigned short)(*((char*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
+ hw_ushort = (unsigned short)(*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
@@ -1703,8 +1703,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw = (unsigned char*)&hw_int;
switch (src_type) {
case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char));
- hw_int = (int)(*((char*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
+ hw_int = (int)(*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
@@ -1749,8 +1749,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw = (unsigned char*)&hw_uint;
switch (src_type) {
case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char));
- hw_uint = (unsigned int)(*((char*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
+ hw_uint = (unsigned int)(*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
@@ -1795,8 +1795,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw = (unsigned char*)&hw_long;
switch (src_type) {
case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char));
- hw_long = (long int)(*((char*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
+ hw_long = (long int)(*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
@@ -1841,8 +1841,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw = (unsigned char*)&hw_ulong;
switch (src_type) {
case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char));
- hw_ulong = (unsigned long)(*((char*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
+ hw_ulong = (unsigned long)(*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
@@ -1933,8 +1933,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw = (unsigned char*)&hw_ullong;
switch (src_type) {
case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char));
- hw_ullong = (unsigned long_long)(*((char*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
+ hw_ullong = (unsigned long_long)(*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
@@ -2107,8 +2107,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
printf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
switch (src_type) {
case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char));
- printf(" %29d\n", (int)*((char*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
+ printf(" %29d\n", (int)*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
@@ -2156,8 +2156,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
switch (dst_type) {
case INT_SCHAR:
- HDmemcpy(aligned, buf+j*sizeof(char), sizeof(char));
- printf(" %29d\n", (int)*((char*)aligned));
+ HDmemcpy(aligned, buf+j*sizeof(signed char), sizeof(signed char));
+ printf(" %29d\n", (int)*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, buf+j*sizeof(unsigned char), sizeof(unsigned char));
@@ -3870,7 +3870,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* acceptable. We allow it to go through instead of fail it. Sometimes, there's roundup
* to the 3rd last byte of mantissa. So we only try to compare all but the last 3 bytes.
*/
-#ifndef H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS
+#ifndef H5_ULLONG_TO_LDOUBLE_PRECISION
#if H5_SIZEOF_LONG_DOUBLE !=0
if(src_type==INT_ULLONG && dst_type==FLT_LDOUBLE) {
long double tmp_s, tmp_h;
@@ -3881,7 +3881,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
continue; /*no error*/
}
#endif
-#endif /*end H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS*/
+#endif /*end H5_ULLONG_TO_LDOUBLE_PRECISION*/
/* Print errors */
if (0==fails_this_test++) {
@@ -4501,7 +4501,7 @@ run_int_fp_conv(const char *name)
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
#endif
-#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
+#if H5_INTEGER_TO_LDOUBLE_ACCURATE
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UCHAR, H5T_NATIVE_LDOUBLE);
@@ -4515,9 +4515,9 @@ run_int_fp_conv(const char *name)
#endif
#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE);
-#if H5_ULLONG_TO_FP_CAST_WORKS && H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS
+#if H5_ULLONG_TO_FP_CAST_WORKS && H5_ULLONG_TO_LDOUBLE_PRECISION
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULLONG, H5T_NATIVE_LDOUBLE);
-#else /* H5_ULLONG_TO_FP_CAST_WORKS && H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS */
+#else /* H5_ULLONG_TO_FP_CAST_WORKS && H5_ULLONG_TO_LDOUBLE_PRECISION */
{
char str[256]; /*hello string */
@@ -4527,10 +4527,10 @@ run_int_fp_conv(const char *name)
SKIPPED();
HDputs(" Test skipped due to compiler not handling conversion.");
}
-#endif /* H5_ULLONG_TO_FP_CAST_WORKS && H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS */
+#endif /* H5_ULLONG_TO_FP_CAST_WORKS && H5_ULLONG_TO_LDOUBLE_PRECISION */
#endif
#endif
-#else /*H5_SW_INTEGER_TO_LDOUBLE_WORKS*/
+#else /*H5_INTEGER_TO_LDOUBLE_ACCURATE*/
{
char str[256]; /*string */
@@ -4545,7 +4545,7 @@ run_int_fp_conv(const char *name)
#endif
}
-#endif /*H5_SW_INTEGER_TO_LDOUBLE_WORKS*/
+#endif /*H5_INTEGER_TO_LDOUBLE_ACCURATE*/
return nerrors;
}
@@ -4650,16 +4650,16 @@ run_fp_int_conv(const char *name)
#endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/
#endif
-#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
+#if H5_LDOUBLE_TO_INTEGER_WORKS && H5_LDOUBLE_TO_INTEGER_ACCURATE
#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);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT);
-#if H5_CV_LDOUBLE_TO_UINT_WORKS
+#if H5_LDOUBLE_TO_UINT_ACCURATE
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT);
-#else /*H5_CV_LDOUBLE_TO_UINT_WORKS*/
+#else /*H5_LDOUBLE_TO_UINT_ACCURATE*/
{
char str[256]; /*string */
@@ -4673,7 +4673,7 @@ run_fp_int_conv(const char *name)
HDputs(" Test skipped due to disabled long double.");
#endif
}
-#endif /*H5_CV_LDOUBLE_TO_UINT_WORKS*/
+#endif /*H5_LDOUBLE_TO_UINT_ACCURATE*/
#if H5_SIZEOF_LONG!=H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE!=0
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG);
@@ -4700,7 +4700,7 @@ run_fp_int_conv(const char *name)
#endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/
#endif
#endif
-#else /*H5_SW_LDOUBLE_TO_INTEGER_WORKS*/
+#else /*H5_LDOUBLE_TO_INTEGER_WORKS && H5_LDOUBLE_TO_INTEGER_ACCURATE*/
{
char str[256]; /*hello string */
@@ -4714,7 +4714,7 @@ run_fp_int_conv(const char *name)
HDputs(" Test skipped due to disabled long double.");
#endif
}
-#endif /*H5_SW_LDOUBLE_TO_INTEGER_WORKS*/
+#endif /*H5_LDOUBLE_TO_INTEGER_WORKS && H5_LDOUBLE_TO_INTEGER_ACCURATE*/
}
} else {
char str[256]; /*string */