diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2005-08-29 15:21:58 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2005-08-29 15:21:58 (GMT) |
commit | bd4312d0497592a665a25415ec2f9d3db9d9f6b2 (patch) | |
tree | 4c9e7590f44a1382ed651756835391245103efa6 /test/dt_arith.c | |
parent | 636b5829a9c5c8908f4eefa71f7b653f4f1697ea (diff) | |
download | hdf5-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.
Diffstat (limited to 'test/dt_arith.c')
-rw-r--r-- | test/dt_arith.c | 86 |
1 files changed, 43 insertions, 43 deletions
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 */ |