summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-04-30 14:11:43 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-04-30 14:11:43 (GMT)
commita58adc04a7368f65b7822b8c0811ebaad8243ee5 (patch)
treef366205a0437414f5c0aa3d328372add641683ab
parentce625901446422f7fed69b4a363863d765ea8342 (diff)
downloadhdf5-a58adc04a7368f65b7822b8c0811ebaad8243ee5.zip
hdf5-a58adc04a7368f65b7822b8c0811ebaad8243ee5.tar.gz
hdf5-a58adc04a7368f65b7822b8c0811ebaad8243ee5.tar.bz2
[svn-r8436] 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 f109e27..e56ddf0 100644
--- a/src/H5Vprivate.h
+++ b/src/H5Vprivate.h
@@ -231,11 +231,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:
@@ -271,11 +273,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: