From 793f8cadd39d0ef1ab1878569daa1d5237401496 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 10 Apr 2004 12:12:42 -0500 Subject: [svn-r8339] 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 --- src/H5Shyper.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 176959f..f3ac46e 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -5196,6 +5196,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; @@ -5217,13 +5218,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; ulow=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]; @@ -7297,7 +7298,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 */ @@ -7354,8 +7355,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 */ @@ -7365,10 +7366,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--) { -- cgit v0.12