diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-01-31 15:16:52 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-01-31 15:16:52 (GMT) |
commit | efca86dc64d5b72c75603c93730c4273e6d5335f (patch) | |
tree | 91fe6d2ae10b5923d50a0c5965012f8a57cb29f1 /test | |
parent | a2670d00c71870b3c68edf618756a6561f8641cf (diff) | |
download | hdf5-efca86dc64d5b72c75603c93730c4273e6d5335f.zip hdf5-efca86dc64d5b72c75603c93730c4273e6d5335f.tar.gz hdf5-efca86dc64d5b72c75603c93730c4273e6d5335f.tar.bz2 |
[svn-r8133] Purpose:
Optimization
Description:
Improve the time this takes to run by hoisting a check for the signed-ness
of the source and destination datatypes out of inner loop. (Speeds up test time
by almost 1/3)
Platforms tested:
IBM p690 (copper)
too minor for h5committest
Diffstat (limited to 'test')
-rw-r--r-- | test/dtypes.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/dtypes.c b/test/dtypes.c index c306e83..88ddd81 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -2799,6 +2799,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) unsigned char dst_bits[32]; /*dest value in LE order*/ size_t src_nbits; /*source length in bits */ size_t dst_nbits; /*dst length in bits */ + H5T_sign_t src_sign; /*source sign type */ + H5T_sign_t dst_sign; /*dst sign type */ void *aligned=NULL; /*aligned temp buffer */ signed char hw_char; unsigned char hw_uchar; @@ -2900,6 +2902,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) dst_size = H5Tget_size(dst); src_nbits = H5Tget_precision(src); /* not 8*src_size, esp on J90 - QAK */ dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */ + src_sign = H5Tget_sign(src); /* not 8*src_size, esp on J90 - QAK */ + dst_sign = H5Tget_sign(dst); /* not 8*dst_size, esp on J90 - QAK */ buf = aligned_malloc(nelmts*MAX(src_size, dst_size)); saved = aligned_malloc(nelmts*MAX(src_size, dst_size)); aligned = HDmalloc(sizeof(long_long)); @@ -3428,7 +3432,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) * hardware conversion result during overflows is usually garbage * so we must handle those cases differetly when checking results. */ - if (H5T_SGN_2==H5Tget_sign(src) && H5T_SGN_2==H5Tget_sign(dst)) { + if (H5T_SGN_2==src_sign && H5T_SGN_2==dst_sign) { if (src_nbits>dst_nbits) { if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1) && H5T_bit_find(src_bits, dst_nbits-1, (src_nbits-dst_nbits), @@ -3481,7 +3485,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) } } } - } else if (H5T_SGN_2==H5Tget_sign(src) && H5T_SGN_NONE==H5Tget_sign(dst)) { + } else if (H5T_SGN_2==src_sign && H5T_SGN_NONE==dst_sign) { if (H5T_bit_get_d(src_bits, src_nbits-1, 1)) { /* * The source is negative so the result should be zero. @@ -3504,7 +3508,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) } } - } else if (H5T_SGN_NONE==H5Tget_sign(src) && H5T_SGN_2==H5Tget_sign(dst)) { + } else if (H5T_SGN_NONE==src_sign && H5T_SGN_2==dst_sign) { if (src_nbits>=dst_nbits && H5T_bit_find(src_bits, dst_nbits-1, (src_nbits-dst_nbits)+1, H5T_BIT_LSB, 1)>=0) { |