From 406b5334a38d7ae2d91f593bb767903f9d7321c4 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 26 Sep 2000 00:03:24 -0500 Subject: [svn-r2594] Purpose: Small Code Cleanup Description: Code to optimize adjacent (i.e. contiguous) hyperslab was ugly and used too many temporary variables. Solution: Computed the optimized hyperslabs slightly differently and got rid of unnecessary temporary variables. Platforms tested: FreeBSD 4.1 --- src/H5Shyper.c | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 90bc320..2904b51 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -1034,7 +1034,7 @@ printf("%s: Check 1.0\n",FUNC); * algorithm to compute the offsets and run through as many as possible, * until the buffer fills up. */ - if(num_readextent.u.simple.rank; i++) } /* end for */ space->select.sel_info.hslab.app_diminfo = diminfo; + /* Allocate room for the optimized per-dimension selection info */ + if((diminfo = H5FL_ARR_ALLOC(H5S_hyper_dim_t,space->extent.u.simple.rank,0))==NULL) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate per-dimension vector"); + } /* end if */ + /* Optimize the hyperslab selection to detect contiguously selected block/stride information */ /* Modify the stride, block & count for contiguous hyperslab selections */ for(i=0; iextent.u.simple.rank; i++) { + /* Starting location doesn't get optimized */ + diminfo[i].start = start[i]; + /* contiguous hyperslabs have the block size equal to the stride */ if(stride[i]==block[i]) { - real_count[i]=1; - real_stride[i]=1; - real_block[i]=count[i]*block[i]; + diminfo[i].stride=1; + diminfo[i].count=1; + diminfo[i].block=count[i]*block[i]; } /* end if */ else { - real_stride[i]=stride[i]; - real_count[i]=count[i]; - real_block[i]=block[i]; + diminfo[i].stride=stride[i]; + diminfo[i].count=count[i]; + diminfo[i].block=block[i]; } /* end else */ } /* end for */ - - /* Copy all the per-dimension selection info into the space descriptor */ - if((diminfo = H5FL_ARR_ALLOC(H5S_hyper_dim_t,space->extent.u.simple.rank,0))==NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate per-dimension vector"); - } /* end if */ - for(i=0; iextent.u.simple.rank; i++) { - diminfo[i].start = start[i]; - diminfo[i].stride = real_stride[i]; - diminfo[i].count = real_count[i]; - diminfo[i].block = real_block[i]; - } /* end for */ space->select.sel_info.hslab.diminfo = diminfo; /* Set the number of elements in the hyperslab selection */ -- cgit v0.12