diff options
-rw-r--r-- | config/irix6.x | 6 | ||||
-rwxr-xr-x | configure | 22 | ||||
-rw-r--r-- | configure.in | 17 | ||||
-rw-r--r-- | src/H5Vprivate.h | 29 | ||||
-rw-r--r-- | src/H5config.h.in | 3 |
5 files changed, 67 insertions, 10 deletions
diff --git a/config/irix6.x b/config/irix6.x index 89cd1a4..5aeed35 100644 --- a/config/irix6.x +++ b/config/irix6.x @@ -189,3 +189,9 @@ if [ -z "$hdf5_mpi_complex_derived_datatype_works" -a $CC_BASENAME = cc ]; then # hdf5_mpi_special_collective_io_works='no' fi fi + +# Set flag to generate alternate code for H5V_log2_gen, to avoid +# problems with the MIPSpro compiler 7.30 and IRIX64 6.5 (ie. other +# combinations might work, but haven't been tested) +# (9/15/06 - QAK) +hdf5_cv_bad_log2_code_generated=${hdf5_cv_bad_log2_code_generated='yes'} @@ -51915,6 +51915,28 @@ else echo "${ECHO_T}no" >&6 fi +echo "$as_me:$LINENO: checking if bad code for log2 routine is generated" >&5 +echo $ECHO_N "checking if bad code for log2 routine is generated... $ECHO_C" >&6 +if test "${hdf5_cv_bad_log2_code_generated+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + hdf5_cv_bad_log2_code_generated=no +fi + + +if test ${hdf5_cv_bad_log2_code_generated} = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define BAD_LOG2_CODE_GENERATED 1 +_ACEOF + + 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 + H5_VERSION="`cut -d' ' -f3 $srcdir/README.txt | head -1`" diff --git a/configure.in b/configure.in index edb848c..ef31a23 100644 --- a/configure.in +++ b/configure.in @@ -3244,6 +3244,23 @@ else fi dnl ---------------------------------------------------------------------- +dnl Set the flag to indicate that the machine generates bad code +dnl for the H5V_log2_gen() routine in src/H5Vprivate.h +dnl (This flag should be set to no for all machines, except for SGI IRIX64, +dnl where the cache value is set to yes in it's config file) +dnl +AC_MSG_CHECKING([if bad code for log2 routine is generated]) +AC_CACHE_VAL([hdf5_cv_bad_log2_code_generated], [hdf5_cv_bad_log2_code_generated=no]) + +if test ${hdf5_cv_bad_log2_code_generated} = "yes"; then + AC_DEFINE([BAD_LOG2_CODE_GENERATED], [1], + [Define if your system generates wrong code for log2 routine.]) + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +dnl ---------------------------------------------------------------------- dnl Set some variables for general configuration information to be saved dnl and installed with the libraries. dnl diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h index 5848a57..0554c47 100644 --- a/src/H5Vprivate.h +++ b/src/H5Vprivate.h @@ -346,19 +346,28 @@ static const char LogTable256[] = static H5_inline unsigned UNUSED H5V_log2_gen(hsize_t n) { - unsigned r = 0; /* r will be log2(n) */ + unsigned r; /* r will be log2(n) */ register unsigned int t, tt, ttt; /* temporaries */ - if((ttt = (unsigned)(n >> 32))) - if((tt = (unsigned)(n >> 48))) - r = (t = (unsigned)(n >> 56)) ? 56 + LogTable256[t] : 48 + LogTable256[tt & 0xFF]; +#ifdef H5_BAD_LOG2_CODE_GENERATED + if(n > (uint64_t)0x7fffffffffffffff) + r = 63; + else { + n &= (uint64_t)0x7fffffffffffffff; +#endif /* H5_BAD_LOG2_CODE_GENERATED */ + if((ttt = (unsigned)(n >> 32))) + if((tt = (unsigned)(n >> 48))) + r = (t = (unsigned)(n >> 56)) ? 56 + LogTable256[t] : 48 + LogTable256[tt & 0xFF]; + else + r = (t = (unsigned)(n >> 40)) ? 40 + LogTable256[t] : 32 + LogTable256[ttt & 0xFF]; else - r = (t = (unsigned)(n >> 40)) ? 40 + LogTable256[t] : 32 + LogTable256[ttt & 0xFF]; - else - if((tt = (unsigned)(n >> 16))) - r = (t = (unsigned)(n >> 24)) ? 24 + LogTable256[t] : 16 + LogTable256[tt & 0xFF]; - else - r = (t = (unsigned)(n >> 8)) ? 8 + LogTable256[t] : LogTable256[n]; + if((tt = (unsigned)(n >> 16))) + r = (t = (unsigned)(n >> 24)) ? 24 + LogTable256[t] : 16 + LogTable256[tt & 0xFF]; + else + r = (t = (unsigned)(n >> 8)) ? 8 + LogTable256[t] : LogTable256[n]; +#ifdef H5_BAD_LOG2_CODE_GENERATED + } /* end else */ +#endif /* H5_BAD_LOG2_CODE_GENERATED */ return(r); } /* H5V_log2_gen() */ diff --git a/src/H5config.h.in b/src/H5config.h.in index 9022204..6addc39 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -1,5 +1,8 @@ /* src/H5config.h.in. Generated from configure.in by autoheader. */ +/* Define if your system generates wrong code for log2 routine. */ +#undef BAD_LOG2_CODE_GENERATED + /* Define if your system can handle converting denormalized floating-point values. */ #undef CONVERT_DENORMAL_FLOAT |