summaryrefslogtreecommitdiffstats
path: root/src/H5Shyper.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-04-10 17:12:49 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-04-10 17:12:49 (GMT)
commit3910acb2be598cf4705973a4f128132ea934da4f (patch)
tree108e0905ec6bed3cbcc0abd81e8d566794981b45 /src/H5Shyper.c
parent3270d9e488f05802e717a37c96ebe76359395edb (diff)
downloadhdf5-3910acb2be598cf4705973a4f128132ea934da4f.zip
hdf5-3910acb2be598cf4705973a4f128132ea934da4f.tar.gz
hdf5-3910acb2be598cf4705973a4f128132ea934da4f.tar.bz2
[svn-r8340] Purpose:
Code optimization Description: Remove a memcpy() from a commonly called routine and replace a multiplication with a series of additions. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.9 (sleipnir) too minor to require h5committest
Diffstat (limited to 'src/H5Shyper.c')
-rw-r--r--src/H5Shyper.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 55675c9..af16540 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -5194,6 +5194,7 @@ H5S_hyper_make_spans (unsigned rank, const hssize_t *start, const hsize_t *strid
H5S_hyper_span_t *span; /* New hyperslab span */
H5S_hyper_span_t *last_span;/* Current position in hyperslab span list */
H5S_hyper_span_t *head; /* Head of new hyperslab span list */
+ hsize_t stride_iter; /* Iterator over the stride values */
int i; /* Counters */
unsigned u; /* Counters */
H5S_hyper_span_info_t *ret_value;
@@ -5215,13 +5216,13 @@ H5S_hyper_make_spans (unsigned rank, const hssize_t *start, const hsize_t *strid
head=last_span=NULL;
/* Generate all the spans segments for this dimension */
- for(u=0; u<count[i]; u++) {
+ for(u=0, stride_iter=0; u<count[i]; u++,stride_iter+=stride[i]) {
/* Allocate a span node */
if((span = H5FL_MALLOC(H5S_hyper_span_t))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
/* Set the span's basic information */
- span->low=start[i]+(stride[i]*u);
+ span->low=start[i]+stride_iter;
span->high=span->low+(block[i]-1);
span->nelem=block[i];
span->pstride=stride[i];
@@ -7291,7 +7292,7 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
size_t elmt_size, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes,
hsize_t *off, size_t *len)
{
- hsize_t mem_size[H5O_LAYOUT_NDIMS]; /* Size of the source buffer */
+ hsize_t *mem_size; /* Size of the source buffer */
hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
hssize_t *sel_off; /* Selection offset in dataspace */
hssize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
@@ -7351,8 +7352,8 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
/* Set the local copy of the selection offset */
sel_off=iter->u.hyp.sel_off;
- /* Set up the size of the memory space */
- HDmemcpy(mem_size, iter->u.hyp.size, ndims*sizeof(hsize_t));
+ /* Set up the pointer to the size of the memory space */
+ mem_size=iter->u.hyp.size;
} /* end if */
else {
/* Set the aliases for a few important dimension ranks */
@@ -7362,10 +7363,9 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
/* Set the local copy of the selection offset */
sel_off=space->select.offset;
- /* Set up the size of the memory space */
- HDmemcpy(mem_size, space->extent.u.simple.size, ndims*sizeof(hsize_t));
+ /* Set up the pointer to the size of the memory space */
+ mem_size=space->extent.u.simple.size;
} /* end else */
- mem_size[ndims]=elmt_size;
/* initialize row sizes for each dimension */
for(i=(ndims-1),acc=elmt_size; i>=0; i--) {