diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2015-03-28 02:19:21 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2015-03-28 02:19:21 (GMT) |
commit | c183d0d6f32504fc4829c57e9b9ef0d66a3923cd (patch) | |
tree | 94397a18a7f375b07d1a855d12833c42386f6ff2 /config/cmake/ConversionTests.c | |
parent | 87db75e2e6f88b3dfdaf1c8758a1dbb2396d9105 (diff) | |
download | hdf5-c183d0d6f32504fc4829c57e9b9ef0d66a3923cd.zip hdf5-c183d0d6f32504fc4829c57e9b9ef0d66a3923cd.tar.gz hdf5-c183d0d6f32504fc4829c57e9b9ef0d66a3923cd.tar.bz2 |
[svn-r26638] Description:
Bring r26598 from trunk to 1.8 branch:
Bring r26501 from the autotools_rework branch to the trunk:
Remove ULLONG_TO_LDOUBLE_PRECISION macro/define, as it's targeting bugs
in the FreeBSD and Cygwin compilers.
Tested on:
Linux/32 2.6.18 (jam) w/serial & parallel
(Daily tested on trunk for 2+ days)
Diffstat (limited to 'config/cmake/ConversionTests.c')
-rw-r--r-- | config/cmake/ConversionTests.c | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c index 3003ef2..9a81a20 100644 --- a/config/cmake/ConversionTests.c +++ b/config/cmake/ConversionTests.c @@ -266,82 +266,3 @@ main () #endif -#ifdef H5_ULLONG_TO_LDOUBLE_PRECISION_TEST - -#include <stddef.h> -#include <stdlib.h> -#include <string.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; - } - - /* 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); -} - -#endif - |