summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-04-30 14:13:05 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-04-30 14:13:05 (GMT)
commit243e20669c70482051ec7da7d14a568132756b7c (patch)
tree29c4ebdf17cefcecd04837c074e5799aad9447ef
parente1016ffdd0bcba9b5d575cc6822378a86caa2423 (diff)
downloadhdf5-243e20669c70482051ec7da7d14a568132756b7c.zip
hdf5-243e20669c70482051ec7da7d14a568132756b7c.tar.gz
hdf5-243e20669c70482051ec7da7d14a568132756b7c.tar.bz2
[svn-r8437] Purpose:
Code optimization Description: Hoist some if statements out of a loop in vector comparision routines that are called very frequently by chunking code. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.9 (sleipnir) too minor to require h5committest
-rw-r--r--src/H5Vprivate.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h
index 1247912..3ed0707 100644
--- a/src/H5Vprivate.h
+++ b/src/H5Vprivate.h
@@ -221,11 +221,13 @@ H5V_vector_cmp_u (int n, const hsize_t *v1, const hsize_t *v2)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_vector_cmp_u)
if (v1 == v2) HGOTO_DONE(0)
+ if (v1 == NULL) HGOTO_DONE(-1)
+ if (v2 == NULL) HGOTO_DONE(1)
while (n--) {
- if ((v1 ? *v1 : 0) < (v2 ? *v2 : 0)) HGOTO_DONE(-1)
- if ((v1 ? *v1 : 0) > (v2 ? *v2 : 0)) HGOTO_DONE(1)
- if (v1) v1++;
- if (v2) v2++;
+ if (*v1 < *v2) HGOTO_DONE(-1)
+ if (*v1 > *v2) HGOTO_DONE(1)
+ v1++;
+ v2++;
}
done:
@@ -261,11 +263,13 @@ H5V_vector_cmp_s (unsigned n, const hssize_t *v1, const hssize_t *v2)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_vector_cmp_s)
if (v1 == v2) HGOTO_DONE(0)
+ if (v1 == NULL) HGOTO_DONE(-1)
+ if (v2 == NULL) HGOTO_DONE(1)
while (n--) {
- if ((v1 ? *v1 : 0) < (v2 ? *v2 : 0)) HGOTO_DONE(-1)
- if ((v1 ? *v1 : 0) > (v2 ? *v2 : 0)) HGOTO_DONE(1)
- if (v1) v1++;
- if (v2) v2++;
+ if (*v1 < *v2) HGOTO_DONE(-1)
+ if (*v1 > *v2) HGOTO_DONE(1)
+ v1++;
+ v2++;
}
done: