summaryrefslogtreecommitdiffstats
path: root/src/H5Vprivate.h
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2012-03-22 23:29:10 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2012-03-22 23:29:10 (GMT)
commit542acd43b81ccf2001a7d0229258f5c4ecf359a7 (patch)
treeced7735a65a759ece9fdb5aeca5c69471fbb39dc /src/H5Vprivate.h
parenteb89d7b53ab95623ab454186a602e1cafc7391f0 (diff)
downloadhdf5-542acd43b81ccf2001a7d0229258f5c4ecf359a7.zip
hdf5-542acd43b81ccf2001a7d0229258f5c4ecf359a7.tar.gz
hdf5-542acd43b81ccf2001a7d0229258f5c4ecf359a7.tar.bz2
[svn-r22127] Purpose: Fix earray failure
Description: In H5Dearray.c, functions would "swizzle" the chunk offset and "down" number of chunks in order to more the unlimited dimension to be the first dimension, but they would not swizzle the chunk dimensions. This could cause two chunks to have the same index, causing problems. Modified code to swizzle the chunk dimensions, and added a test. Note: There is still a problem with h5watch that appears to be unrelated. Tested: durandal
Diffstat (limited to 'src/H5Vprivate.h')
-rw-r--r--src/H5Vprivate.h35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h
index 89e1938..c2d4e4a 100644
--- a/src/H5Vprivate.h
+++ b/src/H5Vprivate.h
@@ -49,6 +49,39 @@ typedef herr_t (*H5V_opvv_func_t)(hsize_t dst_off, hsize_t src_off,
#define H5V_vector_zero(N,DST) HDmemset(DST,0,(N)*sizeof(*(DST)))
+/* Given a coordinate offset array (COORDS) of type TYPE, move the unlimited
+ * dimension (UNLIM_DIM) value to offset 0, sliding any intermediate values down
+ * one position. */
+#define H5V_swizzle_coords(TYPE,COORDS,UNLIM_DIM) { \
+ /* COORDS must be an array of type TYPE */ \
+ HDassert(sizeof(COORDS[0]) == sizeof(TYPE)); \
+ \
+ /* Nothing to do when unlimited dimension is at position 0 */ \
+ if(0 != (UNLIM_DIM)) { \
+ TYPE _tmp = (COORDS)[UNLIM_DIM]; \
+ \
+ HDmemmove(&(COORDS)[1], &(COORDS)[0], sizeof(TYPE) * (UNLIM_DIM)); \
+ (COORDS)[0] = _tmp; \
+ } /* end if */ \
+}
+
+/* Given a coordinate offset array (COORDS) of type TYPE, move the value at
+ * offset 0 to offset of the unlimied dimension (UNLIM_DIM), sliding any
+ * intermediate values up one position. Undoes the "swizzle_coords" operation.
+ */
+#define H5V_unswizzle_coords(TYPE,COORDS,UNLIM_DIM) { \
+ /* COORDS must be an array of type TYPE */ \
+ HDassert(sizeof(COORDS[0]) == sizeof(TYPE)); \
+ \
+ /* Nothing to do when unlimited dimension is at position 0 */ \
+ if(0 != (UNLIM_DIM)) { \
+ TYPE _tmp = (COORDS)[0]; \
+ \
+ HDmemmove(&(COORDS)[0], &(COORDS)[1], sizeof(TYPE) * (UNLIM_DIM)); \
+ (COORDS)[UNLIM_DIM] = _tmp; \
+ } /* end if */ \
+}
+
/* A null pointer is equivalent to a zero vector */
#define H5V_ZERO NULL
@@ -93,8 +126,6 @@ H5_DLL herr_t H5V_array_calc(hsize_t offset, unsigned n,
const hsize_t *total_size, hsize_t *coords);
H5_DLL herr_t H5V_chunk_index(unsigned ndims, const hsize_t *coord,
const uint32_t *chunk, const hsize_t *down_nchunks, hsize_t *chunk_idx);
-H5_DLL void H5V_swizzle_coords(hsize_t *coords, unsigned unlim_dim);
-H5_DLL void H5V_unswizzle_coords(hsize_t *coords, unsigned unlim_dim);
H5_DLL ssize_t H5V_opvv(size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[],
hsize_t dst_off_arr[],
size_t src_max_nseq, size_t *src_curr_seq, size_t src_len_arr[],