From 193fc7a70fe457725a213ab9b0bebcb0df502ec1 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 15 Jun 2004 09:58:39 -0500 Subject: [svn-r8690] Purpose: Code optimization Description: Be smarter about copying hyperslab selection data and avoid memcpy() calls. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.10 (sleipnir) w/parallel Too minor to require h5committest --- src/H5Shyper.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 809474b..c9acb26 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -1583,6 +1583,8 @@ done: herr_t H5S_hyper_copy (H5S_t *dst, const H5S_t *src, hbool_t share_selection) { + H5S_hyper_sel_t *dst_hslab; /* Pointer to destination hyperslab info */ + const H5S_hyper_sel_t *src_hslab; /* Pointer to source hyperslab info */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_NOAPI(H5S_hyper_copy, FAIL); @@ -1594,8 +1596,21 @@ H5S_hyper_copy (H5S_t *dst, const H5S_t *src, hbool_t share_selection) if((dst->select.sel_info.hslab=H5FL_MALLOC(H5S_hyper_sel_t))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab info"); + /* Set temporary pointers */ + dst_hslab=dst->select.sel_info.hslab; + src_hslab=src->select.sel_info.hslab; + /* Copy the hyperslab information */ - HDmemcpy(dst->select.sel_info.hslab,src->select.sel_info.hslab,sizeof(H5S_hyper_sel_t)); + dst_hslab->diminfo_valid=src_hslab->diminfo_valid; + if(src_hslab->diminfo_valid) { + size_t u; /* Local index variable */ + + for(u=0; uextent.rank; u++) { + dst_hslab->opt_diminfo[u]=src_hslab->opt_diminfo[u]; + dst_hslab->app_diminfo[u]=src_hslab->app_diminfo[u]; + } /* end for */ + } /* end if */ + dst->select.sel_info.hslab->span_lst=src->select.sel_info.hslab->span_lst; /* Check if there is hyperslab span information to copy */ /* (Regular hyperslab information is copied with the selection structure) */ -- cgit v0.12