diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-01 18:16:22 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-01 18:16:22 (GMT) |
commit | 050ff9dc1a84b609709822a75f5337485396a9a0 (patch) | |
tree | 16c5b549a91323d224b59bd598deb4e41d76e53f /src/H5Sselect.c | |
parent | 9850d9929774126b08ee7b4ecc50c9d25d20c122 (diff) | |
download | hdf5-050ff9dc1a84b609709822a75f5337485396a9a0.zip hdf5-050ff9dc1a84b609709822a75f5337485396a9a0.tar.gz hdf5-050ff9dc1a84b609709822a75f5337485396a9a0.tar.bz2 |
[svn-r8459] Purpose:
Code optimization
Description:
Move the element size for the selection into the selection iterator instead
of always passing it as a parameter.
Also, eleminate another 64-bit multiply for "all" selections.
Platforms tested:
Solaris 2.7 (arabica)
FreeBSD 4.9 (sleipnir)
too minor to require h5committest
Diffstat (limited to 'src/H5Sselect.c')
-rw-r--r-- | src/H5Sselect.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 5031921..16eaa22 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -600,8 +600,11 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s else sel_iter->dims = NULL; + /* Save the element size */ + sel_iter->elmt_size=elmt_size; + /* Call initialization routine for selection type */ - ret_value= (*space->select.iter_init)(sel_iter, space, elmt_size); + ret_value= (*space->select.iter_init)(sel_iter, space); done: FUNC_LEAVE_NOAPI(ret_value); @@ -960,7 +963,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t /* Loop, while elements left in selection */ while(max_elem>0 && user_ret==0) { /* Get the sequences of bytes */ - if((*space->select.get_seq_list)(space,0,&iter,elmt_size,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0) + if((*space->select.get_seq_list)(space,0,&iter,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Loop, while sequences left to process */ @@ -1368,7 +1371,7 @@ H5S_select_fill(void *_fill, size_t fill_size, const H5S_t *space, void *_buf) /* Loop, while elements left in selection */ while(max_elem>0) { /* Get the sequences of bytes */ - if((*space->select.get_seq_list)(space,0,&iter,fill_size,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0) + if((*space->select.get_seq_list)(space,0,&iter,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Loop over sequences */ @@ -1421,7 +1424,7 @@ done: herr_t H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, - size_t elmt_size, const H5S_t *space, H5S_sel_iter_t *iter, + const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, const void *_buf) { @@ -1444,7 +1447,6 @@ H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout, /* Check args */ assert (f); assert (layout); - assert (elmt_size>0); assert (store); assert (space); assert (iter); @@ -1470,12 +1472,12 @@ H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout, /* Loop until all elements are written */ while(maxelem>0) { /* Get list of sequences for selection to write */ - if((*space->select.get_seq_list)(space,H5S_GET_SEQ_LIST_SORTED,iter,elmt_size,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) + if((*space->select.get_seq_list)(space,H5S_GET_SEQ_LIST_SORTED,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Reset the current sequence information */ mem_curr_seq=dset_curr_seq=0; - orig_mem_len=mem_len=nelem*elmt_size; + orig_mem_len=mem_len=nelem*iter->elmt_size; mem_off=0; /* Write sequence list out */ @@ -1526,7 +1528,7 @@ done: hsize_t H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, - size_t elmt_size, const H5S_t *space, H5S_sel_iter_t *iter, + const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, void *_buf/*out*/) { @@ -1549,7 +1551,6 @@ H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout, /* Check args */ assert (f); assert (layout); - assert (elmt_size>0); assert (store); assert (space); assert (iter); @@ -1574,12 +1575,12 @@ H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout, /* Loop until all elements are written */ while(maxelem>0) { /* Get list of sequences for selection to write */ - if((*space->select.get_seq_list)(space,H5S_GET_SEQ_LIST_SORTED,iter,elmt_size,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) + if((*space->select.get_seq_list)(space,H5S_GET_SEQ_LIST_SORTED,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); /* Reset the current sequence information */ mem_curr_seq=dset_curr_seq=0; - orig_mem_len=mem_len=nelem*elmt_size; + orig_mem_len=mem_len=nelem*iter->elmt_size; mem_off=0; /* Read sequence list in */ @@ -1622,7 +1623,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_select_mscat (const void *_tscat_buf, size_t elmt_size, const H5S_t *space, +H5S_select_mscat (const void *_tscat_buf, const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, void *_buf/*out*/) { @@ -1643,7 +1644,6 @@ H5S_select_mscat (const void *_tscat_buf, size_t elmt_size, const H5S_t *space, /* Check args */ assert (tscat_buf); - assert (elmt_size>0); assert (space); assert (iter); assert (nelmts>0); @@ -1667,7 +1667,7 @@ H5S_select_mscat (const void *_tscat_buf, size_t elmt_size, const H5S_t *space, /* Loop until all elements are written */ while(maxelem>0) { /* Get list of sequences for selection to write */ - if((*space->select.get_seq_list)(space,0,iter,elmt_size,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) + if((*space->select.get_seq_list)(space,0,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); /* Loop, while sequences left to process */ @@ -1716,7 +1716,7 @@ done: *------------------------------------------------------------------------- */ hsize_t -H5S_select_mgath (const void *_buf, size_t elmt_size, const H5S_t *space, +H5S_select_mgath (const void *_buf, const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, void *_tgath_buf/*out*/) { @@ -1737,7 +1737,6 @@ H5S_select_mgath (const void *_buf, size_t elmt_size, const H5S_t *space, /* Check args */ assert (buf); - assert (elmt_size>0); assert (space); assert (iter); assert (nelmts>0); @@ -1761,7 +1760,7 @@ H5S_select_mgath (const void *_buf, size_t elmt_size, const H5S_t *space, /* Loop until all elements are written */ while(maxelem>0) { /* Get list of sequences for selection to write */ - if((*space->select.get_seq_list)(space,0,iter,elmt_size,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) + if((*space->select.get_seq_list)(space,0,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); /* Loop, while sequences left to process */ @@ -1887,7 +1886,7 @@ H5S_select_read(H5F_t *f, const H5O_layout_t *layout, const H5D_dcpl_cache_t *dc /* Check if more file sequences are needed */ if(curr_file_seq>=file_nseq) { /* Get sequences for file selection */ - if((*file_space->select.get_seq_list)(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,elmt_size,dxpl_cache->vec_size,maxelem,&file_nseq,&file_nelem,file_off,file_len)<0) + if((*file_space->select.get_seq_list)(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,dxpl_cache->vec_size,maxelem,&file_nseq,&file_nelem,file_off,file_len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ @@ -1897,7 +1896,7 @@ H5S_select_read(H5F_t *f, const H5O_layout_t *layout, const H5D_dcpl_cache_t *dc /* Check if more memory sequences are needed */ if(curr_mem_seq>=mem_nseq) { /* Get sequences for memory selection */ - if((*mem_space->select.get_seq_list)(mem_space,0,&mem_iter,elmt_size,dxpl_cache->vec_size,maxelem,&mem_nseq,&mem_nelem,mem_off,mem_len)<0) + if((*mem_space->select.get_seq_list)(mem_space,0,&mem_iter,dxpl_cache->vec_size,maxelem,&mem_nseq,&mem_nelem,mem_off,mem_len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ @@ -2065,7 +2064,7 @@ H5S_select_write(H5F_t *f, H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_ca #endif /* QAK */ if(curr_file_seq>=file_nseq) { /* Get sequences for file selection */ - if((*file_space->select.get_seq_list)(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,elmt_size,dxpl_cache->vec_size,maxelem,&file_nseq,&file_nelem,file_off,file_len)<0) + if((*file_space->select.get_seq_list)(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,dxpl_cache->vec_size,maxelem,&file_nseq,&file_nelem,file_off,file_len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ @@ -2084,7 +2083,7 @@ H5S_select_write(H5F_t *f, H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_ca /* Check if more memory sequences are needed */ if(curr_mem_seq>=mem_nseq) { /* Get sequences for memory selection */ - if((*mem_space->select.get_seq_list)(mem_space,0,&mem_iter,elmt_size,dxpl_cache->vec_size,maxelem,&mem_nseq,&mem_nelem,mem_off,mem_len)<0) + if((*mem_space->select.get_seq_list)(mem_space,0,&mem_iter,dxpl_cache->vec_size,maxelem,&mem_nseq,&mem_nelem,mem_off,mem_len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ |