diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-01 16:10:17 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-01 16:10:17 (GMT) |
commit | ecea60e95cd0ddd72ba975a79d5ca65805a44dd5 (patch) | |
tree | 2a8fdb9b8e8d210e67a095f0fd505ab912ff331a /src/H5Spoint.c | |
parent | 4f0b880861c6d719ef30302ebc522abdaf84b292 (diff) | |
download | hdf5-ecea60e95cd0ddd72ba975a79d5ca65805a44dd5.zip hdf5-ecea60e95cd0ddd72ba975a79d5ca65805a44dd5.tar.gz hdf5-ecea60e95cd0ddd72ba975a79d5ca65805a44dd5.tar.bz2 |
[svn-r8457] Purpose:
Code optimization
Description:
Stop straddling the line and always use elements instead of bytes to
determine how how I/O to perform on a selection.
Platforms tested:
Solaris 2.7 (arabica)
FreeBSD 4.9 (sleipnir)
too minor to require h5committest
Diffstat (limited to 'src/H5Spoint.c')
-rw-r--r-- | src/H5Spoint.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 0200a7c..b9e0b8a 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -1287,7 +1287,7 @@ H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space"); if (H5S_NULL==H5S_get_simple_extent_type(space)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_NULL space"); - if(coord==NULL || num_elem==0) + if(coord==NULL || num_elem==0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "elements not specified"); if(!(op==H5S_SELECT_SET || op==H5S_SELECT_APPEND || op==H5S_SELECT_PREPEND)) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operations other than H5S_SELECT_SET not supported currently"); @@ -1314,10 +1314,10 @@ done: position of interest in selection. size_t elem_size; IN: Size of an element size_t maxseq; IN: Maximum number of sequences to generate - size_t maxbytes; IN: Maximum number of bytes to include in the + size_t maxelem; IN: Maximum number of elements to include in the generated sequences size_t *nseq; OUT: Actual number of sequences generated - size_t *nbytes; OUT: Actual number of bytes in sequences generated + size_t *nelem; OUT: Actual number of elements in sequences generated hsize_t *off; OUT: Array of offsets size_t *len; OUT: Array of lengths RETURNS @@ -1335,11 +1335,11 @@ done: --------------------------------------------------------------------------*/ herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, - size_t elem_size, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, + size_t elem_size, size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len) { - hsize_t bytes_left; /* The number of bytes left in the selection */ - hsize_t start_bytes_left; /* The initial number of bytes left in the selection */ + size_t io_left; /* The number of bytes left in the selection */ + size_t start_io_left; /* The initial number of bytes left in the selection */ H5S_pnt_node_t *node; /* Point node */ hsize_t dims[H5O_LAYOUT_NDIMS]; /* Total size of memory buf */ int ndims; /* Dimensionality of space*/ @@ -1356,17 +1356,15 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, assert(iter); assert(elem_size>0); assert(maxseq>0); - assert(maxbytes>0); + assert(maxelem>0); assert(nseq); - assert(nbytes); + assert(nelem); assert(off); assert(len); - /* "round" off the maxbytes allowed to a multiple of the element size */ - maxbytes=(maxbytes/elem_size)*elem_size; - /* Choose the minimum number of bytes to sequence through */ - start_bytes_left=bytes_left=MIN(iter->elmt_left*elem_size,maxbytes); + H5_CHECK_OVERFLOW(iter->elmt_left,hsize_t,size_t); + start_io_left=io_left=MIN(iter->elmt_left,maxelem); /* Get the dataspace dimensions */ if ((ndims=H5S_get_simple_extent_dims (space, dims, NULL))<0) @@ -1413,8 +1411,8 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, curr_seq++; } /* end else */ - /* Decrement number of bytes left to process */ - bytes_left-=elem_size; + /* Decrement number of elements left to process */ + io_left--; /* Move the iterator */ iter->u.pnt.curr=node->next; @@ -1424,8 +1422,8 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, if(curr_seq==maxseq) break; - /* Check if we're finished with all the bytes available */ - if(bytes_left==0) + /* Check if we're finished with all the elements available */ + if(io_left==0) break; /* Advance to the next point */ @@ -1435,9 +1433,8 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, /* Set the number of sequences generated */ *nseq=curr_seq; - /* Set the number of bytes used */ - H5_CHECK_OVERFLOW( (start_bytes_left-bytes_left) ,hsize_t,size_t); - *nbytes=(size_t)(start_bytes_left-bytes_left); + /* Set the number of elements used */ + *nelem=start_io_left-io_left; done: FUNC_LEAVE_NOAPI(ret_value); |