summaryrefslogtreecommitdiffstats
path: root/src/H5Shyper.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-10-18 16:22:48 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-10-18 16:22:48 (GMT)
commite6aed98f8f5ee24737995571914deb1e20331f36 (patch)
treecbe206b271b7580f5b2220e3c8c003274f5c8888 /src/H5Shyper.c
parentece7defd50002dd4041ea433dc3bcaae9b1939a6 (diff)
downloadhdf5-e6aed98f8f5ee24737995571914deb1e20331f36.zip
hdf5-e6aed98f8f5ee24737995571914deb1e20331f36.tar.gz
hdf5-e6aed98f8f5ee24737995571914deb1e20331f36.tar.bz2
[svn-r7663] Purpose:
Code cleanup Description: Re-wrote duff's device with some macro substitution to make algorithm more obvious. Platforms tested: FreeBSD 4.9 (sleipnir) too small to require h5committest
Diffstat (limited to 'src/H5Shyper.c')
-rw-r--r--src/H5Shyper.c146
1 files changed, 40 insertions, 106 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index f3640ac..6564bbc 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -7099,9 +7099,6 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
size_t nelmts; /* Starting number of elements */
size_t io_left; /* The number of elements left in I/O operation */
size_t start_io_left; /* The initial number of elements left in I/O operation */
-#ifndef NO_DUFFS_DEVICE
- size_t duffs_index; /* Counting index for Duff's device */
-#endif /* NO_DUFFS_DEVICE */
FUNC_ENTER_NOINIT (H5S_hyper_get_seq_list_opt);
@@ -7346,118 +7343,55 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
/* Read in data until an entire sequence can't be written out any longer */
while(curr_rows>0) {
+
+#define DUFF_GUTS \
+ /* Store the sequence information */ \
+ off[curr_seq]=loc; \
+ len[curr_seq]=actual_bytes; \
+ \
+ /* Increment sequence count */ \
+ curr_seq++; \
+ \
+ /* Increment information to reflect block just processed */ \
+ loc+=fast_dim_buf_off;
+
#ifdef NO_DUFFS_DEVICE
/* Loop over all the blocks in the fastest changing dimension */
while(fast_dim_count>0) {
- /* Store the sequence information */
- off[curr_seq]=loc;
- len[curr_seq]=actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Increment information to reflect block just processed */
- loc+=fast_dim_buf_off;
+ DUFF_GUTS
/* Decrement number of blocks */
fast_dim_count--;
} /* end while */
#else /* NO_DUFFS_DEVICE */
- duffs_index = (fast_dim_count + 7) / 8;
- switch (fast_dim_count % 8) {
- case 0:
- do
- {
- /* Store the sequence information */
- off[curr_seq]=loc;
- len[curr_seq]=actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Increment information to reflect block just processed */
- loc+=fast_dim_buf_off;
-
- case 7:
- /* Store the sequence information */
- off[curr_seq]=loc;
- len[curr_seq]=actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Increment information to reflect block just processed */
- loc+=fast_dim_buf_off;
-
- case 6:
- /* Store the sequence information */
- off[curr_seq]=loc;
- len[curr_seq]=actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Increment information to reflect block just processed */
- loc+=fast_dim_buf_off;
-
- case 5:
- /* Store the sequence information */
- off[curr_seq]=loc;
- len[curr_seq]=actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Increment information to reflect block just processed */
- loc+=fast_dim_buf_off;
-
- case 4:
- /* Store the sequence information */
- off[curr_seq]=loc;
- len[curr_seq]=actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Increment information to reflect block just processed */
- loc+=fast_dim_buf_off;
-
- case 3:
- /* Store the sequence information */
- off[curr_seq]=loc;
- len[curr_seq]=actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Increment information to reflect block just processed */
- loc+=fast_dim_buf_off;
-
- case 2:
- /* Store the sequence information */
- off[curr_seq]=loc;
- len[curr_seq]=actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Increment information to reflect block just processed */
- loc+=fast_dim_buf_off;
-
- case 1:
- /* Store the sequence information */
- off[curr_seq]=loc;
- len[curr_seq]=actual_bytes;
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Increment information to reflect block just processed */
- loc+=fast_dim_buf_off;
-
- } while (--duffs_index > 0);
- } /* end switch */
+ {
+ size_t duffs_index; /* Counting index for Duff's device */
+
+ duffs_index = (fast_dim_count + 7) / 8;
+ switch (fast_dim_count % 8) {
+ case 0:
+ do
+ {
+ DUFF_GUTS
+ case 7:
+ DUFF_GUTS
+ case 6:
+ DUFF_GUTS
+ case 5:
+ DUFF_GUTS
+ case 4:
+ DUFF_GUTS
+ case 3:
+ DUFF_GUTS
+ case 2:
+ DUFF_GUTS
+ case 1:
+ DUFF_GUTS
+ } while (--duffs_index > 0);
+ } /* end switch */
+ }
#endif /* NO_DUFFS_DEVICE */
+#undef DUFF_GUTS
/* Increment offset in destination buffer */
loc += wrap[fast_dim];