summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Sselect.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 5b751c1..9f9e33b 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -304,7 +304,8 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Step through all the blocks to add */
/* (reuse the count in ACC above) */
- for(i=0; i<(int)acc; i++) {
+ /* Adding the blocks in reverse order reduces the time spent moving memory around in H5S_hyper_add() */
+ for(i=(int)acc-1; i>=0; i--) {
/* Build the location of the block */
for(j=0; j<space->extent.u.simple.rank; j++)
slab[j]=start[j]+((i/slice[j])%count[j])*stride[j];